1 //===-- SBBroadcaster.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 #ifndef LLDB_SBBroadcaster_h_
11 #define LLDB_SBBroadcaster_h_
12 
13 #include "lldb/API/SBDefines.h"
14 
15 namespace lldb {
16 
17 class LLDB_API SBBroadcaster {
18 public:
19   SBBroadcaster();
20 
21   SBBroadcaster(const char *name);
22 
23   SBBroadcaster(const SBBroadcaster &rhs);
24 
25   const SBBroadcaster &operator=(const SBBroadcaster &rhs);
26 
27   ~SBBroadcaster();
28 
29   bool IsValid() const;
30 
31   void Clear();
32 
33   void BroadcastEventByType(uint32_t event_type, bool unique = false);
34 
35   void BroadcastEvent(const lldb::SBEvent &event, bool unique = false);
36 
37   void AddInitialEventsToListener(const lldb::SBListener &listener,
38                                   uint32_t requested_events);
39 
40   uint32_t AddListener(const lldb::SBListener &listener, uint32_t event_mask);
41 
42   const char *GetName() const;
43 
44   bool EventTypeHasListeners(uint32_t event_type);
45 
46   bool RemoveListener(const lldb::SBListener &listener,
47                       uint32_t event_mask = UINT32_MAX);
48 
49   // This comparison is checking if the internal opaque pointer value is equal
50   // to that in "rhs".
51   bool operator==(const lldb::SBBroadcaster &rhs) const;
52 
53   // This comparison is checking if the internal opaque pointer value is not
54   // equal to that in "rhs".
55   bool operator!=(const lldb::SBBroadcaster &rhs) const;
56 
57   // This comparison is checking if the internal opaque pointer value is less
58   // than that in "rhs" so SBBroadcaster objects can be contained in ordered
59   // containers.
60   bool operator<(const lldb::SBBroadcaster &rhs) const;
61 
62 protected:
63   friend class SBCommandInterpreter;
64   friend class SBCommunication;
65   friend class SBEvent;
66   friend class SBListener;
67   friend class SBProcess;
68   friend class SBTarget;
69 
70   SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns);
71 
72   lldb_private::Broadcaster *get() const;
73 
74   void reset(lldb_private::Broadcaster *broadcaster, bool owns);
75 
76 private:
77   lldb::BroadcasterSP m_opaque_sp;
78   lldb_private::Broadcaster *m_opaque_ptr;
79 };
80 
81 } // namespace lldb
82 
83 #endif // LLDB_SBBroadcaster_h_
84