1 //===-- SBListener.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_SBListener_h_ 11 #define LLDB_SBListener_h_ 12 13 #include "lldb/API/SBDefines.h" 14 15 namespace lldb { 16 17 class SBListener 18 { 19 public: 20 SBListener (); 21 22 SBListener (const char *name); 23 24 SBListener (const SBListener &rhs); 25 26 ~SBListener (); 27 28 const lldb::SBListener & 29 operator = (const lldb::SBListener &rhs); 30 31 void 32 AddEvent (const lldb::SBEvent &event); 33 34 void 35 Clear (); 36 37 bool 38 IsValid () const; 39 40 uint32_t 41 StartListeningForEventClass (SBDebugger &debugger, 42 const char *broadcaster_class, 43 uint32_t event_mask); 44 45 bool 46 StopListeningForEventClass (SBDebugger &debugger, 47 const char *broadcaster_class, 48 uint32_t event_mask); 49 50 uint32_t 51 StartListeningForEvents (const lldb::SBBroadcaster& broadcaster, 52 uint32_t event_mask); 53 54 bool 55 StopListeningForEvents (const lldb::SBBroadcaster& broadcaster, 56 uint32_t event_mask); 57 58 // Returns true if an event was recieved, false if we timed out. 59 bool 60 WaitForEvent (uint32_t num_seconds, 61 lldb::SBEvent &event); 62 63 bool 64 WaitForEventForBroadcaster (uint32_t num_seconds, 65 const lldb::SBBroadcaster &broadcaster, 66 lldb::SBEvent &sb_event); 67 68 bool 69 WaitForEventForBroadcasterWithType (uint32_t num_seconds, 70 const lldb::SBBroadcaster &broadcaster, 71 uint32_t event_type_mask, 72 lldb::SBEvent &sb_event); 73 74 bool 75 PeekAtNextEvent (lldb::SBEvent &sb_event); 76 77 bool 78 PeekAtNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster, 79 lldb::SBEvent &sb_event); 80 81 bool 82 PeekAtNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster, 83 uint32_t event_type_mask, 84 lldb::SBEvent &sb_event); 85 86 bool 87 GetNextEvent (lldb::SBEvent &sb_event); 88 89 bool 90 GetNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster, 91 lldb::SBEvent &sb_event); 92 93 bool 94 GetNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster, 95 uint32_t event_type_mask, 96 lldb::SBEvent &sb_event); 97 98 bool 99 HandleBroadcastEvent (const lldb::SBEvent &event); 100 101 protected: 102 friend class SBBroadcaster; 103 friend class SBCommandInterpreter; 104 friend class SBDebugger; 105 friend class SBTarget; 106 107 SBListener (lldb_private::Listener &listener); 108 109 private: 110 111 lldb_private::Listener * 112 operator->() const; 113 114 lldb_private::Listener * 115 get() const; 116 117 lldb_private::Listener & 118 ref() const; 119 120 lldb_private::Listener & 121 operator *(); 122 123 const lldb_private::Listener & 124 operator *() const; 125 126 void 127 reset(lldb_private::Listener *listener, bool transfer_ownership); 128 129 lldb::ListenerSP m_opaque_sp; 130 lldb_private::Listener *m_opaque_ptr; 131 }; 132 133 } // namespace lldb 134 135 #endif // LLDB_SBListener_h_ 136