1 //===-- SBListener.h --------------------------------------------*- 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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SBListener_h_
10 #define LLDB_SBListener_h_
12 #include "lldb/API/SBDefines.h"
16 class LLDB_API SBListener {
20 SBListener(const char *name);
22 SBListener(const SBListener &rhs);
26 const lldb::SBListener &operator=(const lldb::SBListener &rhs);
28 void AddEvent(const lldb::SBEvent &event);
32 explicit operator bool() const;
36 uint32_t StartListeningForEventClass(SBDebugger &debugger,
37 const char *broadcaster_class,
40 bool StopListeningForEventClass(SBDebugger &debugger,
41 const char *broadcaster_class,
44 uint32_t StartListeningForEvents(const lldb::SBBroadcaster &broadcaster,
47 bool StopListeningForEvents(const lldb::SBBroadcaster &broadcaster,
50 // Returns true if an event was received, false if we timed out.
51 bool WaitForEvent(uint32_t num_seconds, lldb::SBEvent &event);
53 bool WaitForEventForBroadcaster(uint32_t num_seconds,
54 const lldb::SBBroadcaster &broadcaster,
55 lldb::SBEvent &sb_event);
57 bool WaitForEventForBroadcasterWithType(
58 uint32_t num_seconds, const lldb::SBBroadcaster &broadcaster,
59 uint32_t event_type_mask, lldb::SBEvent &sb_event);
61 bool PeekAtNextEvent(lldb::SBEvent &sb_event);
63 bool PeekAtNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
64 lldb::SBEvent &sb_event);
67 PeekAtNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
68 uint32_t event_type_mask,
69 lldb::SBEvent &sb_event);
71 bool GetNextEvent(lldb::SBEvent &sb_event);
73 bool GetNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
74 lldb::SBEvent &sb_event);
77 GetNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
78 uint32_t event_type_mask,
79 lldb::SBEvent &sb_event);
81 bool HandleBroadcastEvent(const lldb::SBEvent &event);
84 friend class SBAttachInfo;
85 friend class SBBroadcaster;
86 friend class SBCommandInterpreter;
87 friend class SBDebugger;
88 friend class SBLaunchInfo;
89 friend class SBTarget;
91 SBListener(const lldb::ListenerSP &listener_sp);
93 lldb::ListenerSP GetSP();
96 lldb_private::Listener *operator->() const;
98 lldb_private::Listener *get() const;
100 void reset(lldb::ListenerSP listener_sp);
102 lldb::ListenerSP m_opaque_sp;
103 lldb_private::Listener *m_unused_ptr;
108 #endif // LLDB_SBListener_h_