1 //===-- MICmdMgrSetCmdDeleteCallback.cpp ------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 #include "MICmdMgrSetCmdDeleteCallback.h"
12 namespace CMICmdMgrSetCmdDeleteCallback {
15 // Details: CSetClients constructor.
21 CSetClients::CSetClients() : m_bClientUnregistered(false) {}
24 // Details: CSetClients destructor.
30 CSetClients::~CSetClients() {}
33 // Details: Register an object to be called when a command object is deleted.
35 // Args: vObject - (R) A new interested client.
36 // Return: MIstatus::success - Functional succeeded.
37 // MIstatus::failure - Functional failed.
40 bool CSetClients::Register(ICallback &vObject) {
43 return MIstatus::success;
47 // Details: Unregister an object from being called when a command object is
50 // Args: vObject - (R) The was interested client.
51 // Return: MIstatus::success - Functional succeeded.
52 // MIstatus::failure - Functional failed.
55 bool CSetClients::Unregister(ICallback &vObject) {
56 m_bClientUnregistered = true;
59 return MIstatus::success;
63 // Details: Iterate all interested clients and tell them a command is being
66 // Args: vCmd - (RW) The command to be deleted.
67 // Return: MIstatus::success - Functional succeeded.
68 // MIstatus::failure - Functional failed.
71 void CSetClients::Delete(SMICmdData &vCmd) {
72 m_bClientUnregistered = false; // Reset
73 iterator it = begin();
75 ICallback *pObj = *it;
78 if (m_bClientUnregistered) {
79 m_bClientUnregistered = false; // Reset
87 } // namespace CMICmdMgrSetCmdDeleteCallback