LLDB  mainline
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
lldb_private::Broadcaster::BroadcasterImpl Class Reference

BroadcasterImpl contains the actual Broadcaster implementation. More...

#include <Broadcaster.h>

Collaboration diagram for lldb_private::Broadcaster::BroadcasterImpl:
Collaboration graph
[legend]

Public Member Functions

 BroadcasterImpl (Broadcaster &broadcaster)
 
 ~BroadcasterImpl ()=default
 
void BroadcastEvent (lldb::EventSP &event_sp)
 
void BroadcastEventIfUnique (lldb::EventSP &event_sp)
 
void BroadcastEvent (uint32_t event_type, EventData *event_data=nullptr)
 
void BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp)
 
void BroadcastEventIfUnique (uint32_t event_type, EventData *event_data=nullptr)
 
void Clear ()
 
uint32_t AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask)
 
const char * GetBroadcasterName () const
 
BroadcasterGetBroadcaster ()
 
bool GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const
 
void SetEventName (uint32_t event_mask, const char *name)
 
const char * GetEventName (uint32_t event_mask) const
 
bool EventTypeHasListeners (uint32_t event_type)
 
bool RemoveListener (lldb_private::Listener *listener, uint32_t event_mask=UINT32_MAX)
 
bool RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 
bool HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 
bool IsHijackedForEvent (uint32_t event_mask)
 
void RestoreBroadcaster ()
 

Protected Types

typedef llvm::SmallVector< std::pair< lldb::ListenerWP, uint32_t >, 4 > collection
 
typedef std::map< uint32_t, std::stringevent_names_map
 

Protected Member Functions

void PrivateBroadcastEvent (lldb::EventSP &event_sp, bool unique)
 
const char * GetHijackingListenerName ()
 
llvm::SmallVector< std::pair< lldb::ListenerSP, uint32_t & >, 4 > GetListeners ()
 

Protected Attributes

Broadcasterm_broadcaster
 The broadcaster that this implements. More...
 
event_names_map m_event_names
 Optionally define event names for readability and logging for each event bit. More...
 
collection m_listeners
 A list of Listener / event_mask pairs that are listening to this broadcaster. More...
 
std::recursive_mutex m_listeners_mutex
 A mutex that protects m_listeners. More...
 
std::vector< lldb::ListenerSP > m_hijacking_listeners
 A simple mechanism to intercept events from a broadcaster. More...
 
std::vector< uint32_tm_hijacking_masks
 At some point we may want to have a stack or Listener collections, but for now this is just for private hijacking. More...
 

Private Member Functions

 BroadcasterImpl (const BroadcasterImpl &)=delete
 
const BroadcasterImploperator= (const BroadcasterImpl &)=delete
 

Friends

class Listener
 
class Broadcaster
 

Detailed Description

BroadcasterImpl contains the actual Broadcaster implementation.

The Broadcaster makes a BroadcasterImpl which lives as long as it does. The Listeners & the Events hold a weak pointer to the BroadcasterImpl, so that they can survive if a Broadcaster they were listening to is destroyed w/o their being able to unregister from it (which can happen if the Broadcasters & Listeners are being destroyed on separate threads simultaneously. The Broadcaster itself can't be shared out as a weak pointer, because some things that are broadcasters (e.g. the Target and the Process) are shared in their own right.

For the most part, the Broadcaster functions dispatch to the BroadcasterImpl, and are documented in the public Broadcaster API above.

Definition at line 422 of file Broadcaster.h.

Member Typedef Documentation

◆ collection

typedef llvm::SmallVector<std::pair<lldb::ListenerWP, uint32_t>, 4> lldb_private::Broadcaster::BroadcasterImpl::collection
protected

Definition at line 489 of file Broadcaster.h.

◆ event_names_map

Definition at line 490 of file Broadcaster.h.

Constructor & Destructor Documentation

◆ BroadcasterImpl() [1/2]

Broadcaster::BroadcasterImpl::BroadcasterImpl ( Broadcaster broadcaster)

Definition at line 36 of file Broadcaster.cpp.

◆ ~BroadcasterImpl()

lldb_private::Broadcaster::BroadcasterImpl::~BroadcasterImpl ( )
default

◆ BroadcasterImpl() [2/2]

lldb_private::Broadcaster::BroadcasterImpl::BroadcasterImpl ( const BroadcasterImpl )
privatedelete

Member Function Documentation

◆ AddListener()

uint32_t Broadcaster::BroadcasterImpl::AddListener ( const lldb::ListenerSP &  listener_sp,
uint32_t  event_mask 
)

Definition at line 116 of file Broadcaster.cpp.

◆ BroadcastEvent() [1/3]

void lldb_private::Broadcaster::BroadcasterImpl::BroadcastEvent ( lldb::EventSP &  event_sp)

◆ BroadcastEvent() [2/3]

void Broadcaster::BroadcasterImpl::BroadcastEvent ( uint32_t  event_type,
const lldb::EventDataSP &  event_data_sp 
)

Definition at line 248 of file Broadcaster.cpp.

◆ BroadcastEvent() [3/3]

void Broadcaster::BroadcasterImpl::BroadcastEvent ( uint32_t  event_type,
EventData event_data = nullptr 
)

Definition at line 242 of file Broadcaster.cpp.

◆ BroadcastEventIfUnique() [1/2]

void lldb_private::Broadcaster::BroadcasterImpl::BroadcastEventIfUnique ( lldb::EventSP &  event_sp)

◆ BroadcastEventIfUnique() [2/2]

void Broadcaster::BroadcasterImpl::BroadcastEventIfUnique ( uint32_t  event_type,
EventData event_data = nullptr 
)

Definition at line 254 of file Broadcaster.cpp.

◆ Clear()

void Broadcaster::BroadcasterImpl::Clear ( )

Definition at line 71 of file Broadcaster.cpp.

◆ EventTypeHasListeners()

bool Broadcaster::BroadcasterImpl::EventTypeHasListeners ( uint32_t  event_type)

Definition at line 150 of file Broadcaster.cpp.

◆ GetBroadcaster()

Broadcaster * Broadcaster::BroadcasterImpl::GetBroadcaster ( )

Definition at line 82 of file Broadcaster.cpp.

◆ GetBroadcasterName()

const char* lldb_private::Broadcaster::BroadcasterImpl::GetBroadcasterName ( ) const
inline

◆ GetEventName()

const char* lldb_private::Broadcaster::BroadcasterImpl::GetEventName ( uint32_t  event_mask) const
inline

Definition at line 461 of file Broadcaster.h.

References m_event_names.

◆ GetEventNames()

bool Broadcaster::BroadcasterImpl::GetEventNames ( Stream s,
const uint32_t  event_mask,
bool  prefix_with_broadcaster_name 
) const

◆ GetHijackingListenerName()

const char * Broadcaster::BroadcasterImpl::GetHijackingListenerName ( )
protected

Definition at line 283 of file Broadcaster.cpp.

◆ GetListeners()

llvm::SmallVector< std::pair< ListenerSP, uint32_t & >, 4 > Broadcaster::BroadcasterImpl::GetListeners ( )
protected

Definition at line 55 of file Broadcaster.cpp.

◆ HijackBroadcaster()

bool Broadcaster::BroadcasterImpl::HijackBroadcaster ( const lldb::ListenerSP &  listener_sp,
uint32_t  event_mask = UINT32_MAX 
)

◆ IsHijackedForEvent()

bool Broadcaster::BroadcasterImpl::IsHijackedForEvent ( uint32_t  event_mask)

Definition at line 275 of file Broadcaster.cpp.

◆ operator=()

const BroadcasterImpl& lldb_private::Broadcaster::BroadcasterImpl::operator= ( const BroadcasterImpl )
privatedelete

◆ PrivateBroadcastEvent()

void Broadcaster::BroadcasterImpl::PrivateBroadcastEvent ( lldb::EventSP &  event_sp,
bool  unique 
)
protected

◆ RemoveListener() [1/2]

bool Broadcaster::BroadcasterImpl::RemoveListener ( const lldb::ListenerSP &  listener_sp,
uint32_t  event_mask = UINT32_MAX 
)

Definition at line 178 of file Broadcaster.cpp.

References lldb_private::Broadcaster::RemoveListener().

◆ RemoveListener() [2/2]

bool Broadcaster::BroadcasterImpl::RemoveListener ( lldb_private::Listener listener,
uint32_t  event_mask = UINT32_MAX 
)

Definition at line 163 of file Broadcaster.cpp.

◆ RestoreBroadcaster()

void Broadcaster::BroadcasterImpl::RestoreBroadcaster ( )

◆ SetEventName()

void lldb_private::Broadcaster::BroadcasterImpl::SetEventName ( uint32_t  event_mask,
const char *  name 
)
inline

Definition at line 457 of file Broadcaster.h.

References m_event_names.

Friends And Related Function Documentation

◆ Broadcaster

friend class Broadcaster
friend

Definition at line 424 of file Broadcaster.h.

◆ Listener

friend class Listener
friend

Definition at line 423 of file Broadcaster.h.

Member Data Documentation

◆ m_broadcaster

Broadcaster& lldb_private::Broadcaster::BroadcasterImpl::m_broadcaster
protected

The broadcaster that this implements.

Definition at line 496 of file Broadcaster.h.

Referenced by GetBroadcasterName().

◆ m_event_names

event_names_map lldb_private::Broadcaster::BroadcasterImpl::m_event_names
protected

Optionally define event names for readability and logging for each event bit.

Definition at line 500 of file Broadcaster.h.

Referenced by GetEventName(), and SetEventName().

◆ m_hijacking_listeners

std::vector<lldb::ListenerSP> lldb_private::Broadcaster::BroadcasterImpl::m_hijacking_listeners
protected

A simple mechanism to intercept events from a broadcaster.

Definition at line 510 of file Broadcaster.h.

◆ m_hijacking_masks

std::vector<uint32_t> lldb_private::Broadcaster::BroadcasterImpl::m_hijacking_masks
protected

At some point we may want to have a stack or Listener collections, but for now this is just for private hijacking.

Definition at line 514 of file Broadcaster.h.

◆ m_listeners

collection lldb_private::Broadcaster::BroadcasterImpl::m_listeners
protected

A list of Listener / event_mask pairs that are listening to this broadcaster.

Definition at line 504 of file Broadcaster.h.

◆ m_listeners_mutex

std::recursive_mutex lldb_private::Broadcaster::BroadcasterImpl::m_listeners_mutex
protected

A mutex that protects m_listeners.

Definition at line 507 of file Broadcaster.h.


The documentation for this class was generated from the following files: