本文整理汇总了C++中EventSP类的典型用法代码示例。如果您正苦于以下问题:C++ EventSP类的具体用法?C++ EventSP怎么用?C++ EventSP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventSP类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
bool operator() (const EventSP &event_sp) const
{
if (m_broadcaster && !event_sp->BroadcasterIs(m_broadcaster))
return false;
if (m_broadcaster_names)
{
bool found_source = false;
const ConstString &event_broadcaster_name = event_sp->GetBroadcaster()->GetBroadcasterName();
for (uint32_t i=0; i<m_num_broadcaster_names; ++i)
{
if (m_broadcaster_names[i] == event_broadcaster_name)
{
found_source = true;
break;
}
}
if (!found_source)
return false;
}
if (m_event_type_mask == 0 || m_event_type_mask & event_sp->GetType())
return true;
return false;
}
示例2: FindNextEventInternal
bool Listener::FindNextEventInternal(
std::unique_lock<std::mutex> &lock,
Broadcaster *broadcaster, // nullptr for any broadcaster
const ConstString *broadcaster_names, // nullptr for any event
uint32_t num_broadcaster_names, uint32_t event_type_mask, EventSP &event_sp,
bool remove) {
// NOTE: callers of this function must lock m_events_mutex using a
// Mutex::Locker
// and pass the locker as the first argument. m_events_mutex is no longer
// recursive.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
if (m_events.empty())
return false;
Listener::event_collection::iterator pos = m_events.end();
if (broadcaster == nullptr && broadcaster_names == nullptr &&
event_type_mask == 0) {
pos = m_events.begin();
} else {
pos = std::find_if(m_events.begin(), m_events.end(),
EventMatcher(broadcaster, broadcaster_names,
num_broadcaster_names, event_type_mask));
}
if (pos != m_events.end()) {
event_sp = *pos;
if (log != nullptr)
log->Printf("%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
"broadcaster_names=%p[%u], event_type_mask=0x%8.8x, "
"remove=%i) event %p",
static_cast<void *>(this), GetName(),
static_cast<void *>(broadcaster),
static_cast<const void *>(broadcaster_names),
num_broadcaster_names, event_type_mask, remove,
static_cast<void *>(event_sp.get()));
if (remove) {
m_events.erase(pos);
// Unlock the event queue here. We've removed this event and are about to
// return
// it so it should be okay to get the next event off the queue here - and
// it might
// be useful to do that in the "DoOnRemoval".
lock.unlock();
event_sp->DoOnRemoval();
}
return true;
}
event_sp.reset();
return false;
}
示例3: lock
bool
Listener::FindNextEventInternal
(
Broadcaster *broadcaster, // NULL for any broadcaster
const ConstString *broadcaster_names, // NULL for any event
uint32_t num_broadcaster_names,
uint32_t event_type_mask,
EventSP &event_sp,
bool remove)
{
//LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
Mutex::Locker lock(m_events_mutex);
if (m_events.empty())
return false;
Listener::event_collection::iterator pos = m_events.end();
if (broadcaster == NULL && broadcaster_names == NULL && event_type_mask == 0)
{
pos = m_events.begin();
}
else
{
pos = std::find_if (m_events.begin(), m_events.end(), EventMatcher (broadcaster, broadcaster_names, num_broadcaster_names, event_type_mask));
}
if (pos != m_events.end())
{
event_sp = *pos;
if (remove)
{
m_events.erase(pos);
if (m_events.empty())
m_cond_wait.SetValue (false, eBroadcastNever);
}
// Unlock the event queue here. We've removed this event and are about to return
// it so it should be okay to get the next event off the queue here - and it might
// be useful to do that in the "DoOnRemoval".
lock.Unlock();
// Don't call DoOnRemoval if you aren't removing the event...
if (remove)
event_sp->DoOnRemoval();
return true;
}
event_sp.reset();
return false;
}
示例4: GetEventDataFromEvent
size_t Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent(
const EventSP &event_sp) {
const BreakpointEventData *data = GetEventDataFromEvent(event_sp.get());
if (data)
return data->m_locations.GetSize();
return 0;
}
示例5: GetEventDataFromEvent
WatchpointEventType
Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent (const EventSP &event_sp)
{
const WatchpointEventData *data = GetEventDataFromEvent (event_sp.get());
if (data == NULL)
return eWatchpointEventTypeInvalidType;
else
return data->GetWatchpointEventType();
}
示例6: GetEventDataFromEvent
WatchpointSP Watchpoint::WatchpointEventData::GetWatchpointFromEvent(
const EventSP &event_sp) {
WatchpointSP wp_sp;
const WatchpointEventData *data = GetEventDataFromEvent(event_sp.get());
if (data)
wp_sp = data->m_new_watchpoint_sp;
return wp_sp;
}
示例7: AddEvent
void Listener::AddEvent(EventSP &event_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
if (log != nullptr)
log->Printf("%p Listener('%s')::AddEvent (event_sp = {%p})",
static_cast<void *>(this), m_name.c_str(),
static_cast<void *>(event_sp.get()));
std::lock_guard<std::mutex> guard(m_events_mutex);
m_events.push_back(event_sp);
m_events_condition.notify_all();
}
示例8: HandleBroadcastEvent
size_t Listener::HandleBroadcastEvent(EventSP &event_sp) {
size_t num_handled = 0;
std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
Broadcaster *broadcaster = event_sp->GetBroadcaster();
if (!broadcaster)
return 0;
broadcaster_collection::iterator pos;
broadcaster_collection::iterator end = m_broadcasters.end();
Broadcaster::BroadcasterImplSP broadcaster_impl_sp(
broadcaster->GetBroadcasterImpl());
for (pos = m_broadcasters.find(broadcaster_impl_sp);
pos != end && pos->first.lock() == broadcaster_impl_sp; ++pos) {
BroadcasterInfo info = pos->second;
if (event_sp->GetType() & info.event_mask) {
if (info.callback != nullptr) {
info.callback(event_sp, info.callback_user_data);
++num_handled;
}
}
}
return num_handled;
}
示例9: locker
size_t
Listener::HandleBroadcastEvent (EventSP &event_sp)
{
size_t num_handled = 0;
Mutex::Locker locker(m_broadcasters_mutex);
Broadcaster *broadcaster = event_sp->GetBroadcaster();
broadcaster_collection::iterator pos;
broadcaster_collection::iterator end = m_broadcasters.end();
for (pos = m_broadcasters.find (broadcaster);
pos != end && pos->first == broadcaster;
++pos)
{
BroadcasterInfo info = pos->second;
if (event_sp->GetType () & info.event_mask)
{
if (info.callback != NULL)
{
info.callback (event_sp, info.callback_user_data);
++num_handled;
}
}
}
return num_handled;
}
示例10:
SBEvent::SBEvent (EventSP &event_sp) :
m_event_sp (event_sp),
m_opaque_ptr (event_sp.get())
{
}
示例11: operator
bool operator()(const EventSP &event_sp) const {
return event_sp->BroadcasterIs(m_broadcaster);
}