]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.h
Merge sync of head
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdMgrSetCmdDeleteCallback.h
1 //===-- MICmdMgrSetCmdDeleteCallback.h --------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 //++
11 // File:        MICmdMgrSetCmdDeleteCallback.h
12 //
13 // Overview:    ICallback   interface.
14 //              CSetClients interface.
15 //
16 // Environment: Compilers:  Visual C++ 12.
17 //                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
18 //              Libraries:  See MIReadmetxt.
19 //
20 // Copyright:   None.
21 //--
22
23 #pragma once
24
25 // Third party headers:
26 #include <set>
27
28 // In-house headers:
29 #include "MICmnBase.h"
30
31 // Declarations:
32 struct SMICmdData;
33
34 namespace CMICmdMgrSetCmdDeleteCallback
35 {
36
37 //++ ============================================================================
38 // Details: MI Command Manager interface for client call back.
39 //          Objects that want to be notified of a command being deleted
40 //          inherit this interface and register interest in command object
41 //          deletion. An object deleting a command must not do it itself but call
42 //          the Command Manager CmdDelete() function to delete a command object.
43 // Gotchas: None.
44 // Authors: Illya Rudkin 21/02/2014.
45 // Changes: None.
46 //--
47 class ICallback
48 {
49   public:
50     virtual void Delete(SMICmdData &vCmd) = 0;
51
52     /* dtor */ virtual ~ICallback(void){};
53 };
54
55 //++ ============================================================================
56 // Details: MI Command Manager container for clients registered interest in command
57 //          objects being deleted. Objects register an interest so when a command
58 //          is to be deleted that object wanting the delete calls the Command
59 //          Manager to delete the command object. In so do all other registered
60 //          objects get called to about the deletion including the object wanting
61 //          to do the delete in the first place.
62 // Gotchas: None.
63 // Authors: Illya Rudkin 21/02/2014.
64 // Changes: None.
65 //--
66 class CSetClients : public std::set<class ICallback *>, public CMICmnBase
67 {
68     // Methods:
69   public:
70     /* ctor */ CSetClients(void);
71
72     bool Register(class ICallback &vObject);
73     bool Unregister(class ICallback &vObject);
74     void Delete(SMICmdData &vCmdData);
75
76     // Overridden:
77   public:
78     // From CMICmnBase
79     /* dtor */ virtual ~CSetClients(void);
80
81     // Attributes:
82   private:
83     bool m_bClientUnregistered; // True = yes while deleting a client unregistered, false = no client unregistered during deletion
84 };
85
86 } // namespace CMICmdMgrSetCmdDeleteCallback