1 //===-- MICmdMgrSetCmdDeleteCallback.cpp ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 #include "MICmdMgrSetCmdDeleteCallback.h"
13 namespace CMICmdMgrSetCmdDeleteCallback {
16 //------------------------------------------------------------------------------------
17 // Details: CSetClients constructor.
23 CSetClients::CSetClients() : m_bClientUnregistered(false) {}
26 //------------------------------------------------------------------------------------
27 // Details: CSetClients destructor.
33 CSetClients::~CSetClients() {}
36 //------------------------------------------------------------------------------------
37 // Details: Register an object to be called when a command object is deleted.
39 // Args: vObject - (R) A new interested client.
40 // Return: MIstatus::success - Functional succeeded.
41 // MIstatus::failure - Functional failed.
44 bool CSetClients::Register(ICallback &vObject) {
47 return MIstatus::success;
51 //------------------------------------------------------------------------------------
52 // Details: Unregister an object from being called when a command object is
55 // Args: vObject - (R) The was interested client.
56 // Return: MIstatus::success - Functional succeeded.
57 // MIstatus::failure - Functional failed.
60 bool CSetClients::Unregister(ICallback &vObject) {
61 m_bClientUnregistered = true;
64 return MIstatus::success;
68 //------------------------------------------------------------------------------------
69 // Details: Iterate all interested clients and tell them a command is being
72 // Args: vCmd - (RW) The command to be deleted.
73 // Return: MIstatus::success - Functional succeeded.
74 // MIstatus::failure - Functional failed.
77 void CSetClients::Delete(SMICmdData &vCmd) {
78 m_bClientUnregistered = false; // Reset
79 iterator it = begin();
81 ICallback *pObj = *it;
84 if (m_bClientUnregistered) {
85 m_bClientUnregistered = false; // Reset
93 } // namespace CMICmdMgrSetCmdDeleteCallback