]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmdMgrSetCmdDeleteCallback.h
1 //===-- MICmdMgrSetCmdDeleteCallback.h --------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //--
9
10 #pragma once
11
12 // Third party headers:
13 #include <set>
14
15 // In-house headers:
16 #include "MICmnBase.h"
17
18 // Declarations:
19 struct SMICmdData;
20
21 namespace CMICmdMgrSetCmdDeleteCallback {
22
23 //++
24 //============================================================================
25 // Details: MI Command Manager interface for client call back.
26 //          Objects that want to be notified of a command being deleted
27 //          inherit this interface and register interest in command object
28 //          deletion. An object deleting a command must not do it itself but
29 //          call
30 //          the Command Manager CmdDelete() function to delete a command object.
31 //--
32 class ICallback {
33 public:
34   virtual void Delete(SMICmdData &vCmd) = 0;
35
36   /* dtor */ virtual ~ICallback() {}
37 };
38
39 //++
40 //============================================================================
41 // Details: MI Command Manager container for clients registered interest in
42 // command
43 //          objects being deleted. Objects register an interest so when a
44 //          command
45 //          is to be deleted that object wanting the delete calls the Command
46 //          Manager to delete the command object. In so do all other registered
47 //          objects get called to about the deletion including the object
48 //          wanting
49 //          to do the delete in the first place.
50 //--
51 class CSetClients : public std::set<class ICallback *>, public CMICmnBase {
52   // Methods:
53 public:
54   /* ctor */ CSetClients();
55
56   bool Register(class ICallback &vObject);
57   bool Unregister(class ICallback &vObject);
58   void Delete(SMICmdData &vCmdData);
59
60   // Overridden:
61 public:
62   // From CMICmnBase
63   /* dtor */ ~CSetClients() override;
64
65   // Attributes:
66 private:
67   bool m_bClientUnregistered; // True = yes while deleting a client
68                               // unregistered, false = no client unregistered
69                               // during deletion
70 };
71
72 } // namespace CMICmdMgrSetCmdDeleteCallback