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 // File: MICmdMgrSetCmdDeleteCallback.cpp
13 // Overview: CSetClients implementation.
15 // Environment: Compilers: Visual C++ 12.
16 // gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 // Libraries: See MIReadmetxt.
23 #include "MICmdMgrSetCmdDeleteCallback.h"
25 namespace CMICmdMgrSetCmdDeleteCallback
28 //++ ------------------------------------------------------------------------------------
29 // Details: CSetClients constructor.
35 CSetClients::CSetClients( void )
36 : m_bClientUnregistered( false )
40 //++ ------------------------------------------------------------------------------------
41 // Details: CSetClients destructor.
47 CSetClients::~CSetClients( void )
51 //++ ------------------------------------------------------------------------------------
52 // Details: Register an object to be called when a command object is deleted.
54 // Args: vObject - (R) A new interested client.
55 // Return: MIstatus::success - Functional succeeded.
56 // MIstatus::failure - Functional failed.
59 bool CSetClients::Register( ICallback & vObject )
63 return MIstatus::success;
66 //++ ------------------------------------------------------------------------------------
67 // Details: Unregister an object from being called when a command object is deleted.
69 // Args: vObject - (R) The was interested client.
70 // Return: MIstatus::success - Functional succeeded.
71 // MIstatus::failure - Functional failed.
74 bool CSetClients::Unregister( ICallback & vObject )
76 m_bClientUnregistered = true;
79 return MIstatus::success;
82 //++ ------------------------------------------------------------------------------------
83 // Details: Iterate all interested clients and tell them a command is being deleted.
85 // Args: vCmd - (RW) The command to be deleted.
86 // Return: MIstatus::success - Functional succeeded.
87 // MIstatus::failure - Functional failed.
90 void CSetClients::Delete( SMICmdData & vCmd )
92 m_bClientUnregistered = false; // Reset
93 iterator it = begin();
96 ICallback * pObj = *it;
99 if( m_bClientUnregistered )
101 m_bClientUnregistered = false; // Reset
110 } // namespace CMICmdMgrSetCmdDeleteCallback