本文整理汇总了C++中EventMap::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::insert方法的具体用法?C++ EventMap::insert怎么用?C++ EventMap::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventMap
的用法示例。
在下文中一共展示了EventMap::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reply
void
LaunchDaemon::_HandleRegisterLaunchEvent(BMessage* message)
{
uid_t user = _GetUserID(message);
if (user < 0)
return;
if (user == 0 || fUserMode) {
status_t status = B_OK;
const char* name = message->GetString("name");
const char* ownerName = message->GetString("owner");
uint32 flags = message->GetUInt32("flags", 0);
BMessenger source;
if (name != NULL && ownerName != NULL
&& message->FindMessenger("source", &source) == B_OK) {
// Register event
ownerName = get_leaf(ownerName);
ExternalEventSource* event = new (std::nothrow)
ExternalEventSource(source, ownerName, name, flags);
if (event != NULL) {
// Use short name, and fully qualified name
BString eventName = name;
fEvents.insert(std::make_pair(eventName, event));
_ResolveExternalEvents(event, eventName);
eventName.Prepend("/");
eventName.Prepend(ownerName);
fEvents.insert(std::make_pair(eventName, event));
_ResolveExternalEvents(event, eventName);
} else
status = B_NO_MEMORY;
} else
status = B_BAD_VALUE;
BMessage reply((uint32)status);
message->SendReply(&reply);
}
_ForwardEventMessage(user, message);
}
示例2: UpdateEventMap
static void UpdateEventMap()
{
EventMap map;
Thread::Mutex::Scoped l(locker_event);
for(IOMap::const_iterator it = ionew.begin(), ie = ionew.end(); it != ie; ++it)
{
PollIO *io = (*it).second;
iomap[(*it).first] = io;
if (io->newevent)
eventset.insert(io);
}
ionew.clear();
for (EventSet::iterator it = eventset.begin(), ie = eventset.end(); it != ie; ++it)
{
map.insert( std::make_pair(*it, (*it)->event) );
(*it)->update = false;
(*it)->event = (*it)->newevent;
(*it)->newevent = 0;
}
eventset.clear();
wakeup_flag = true;
std::for_each(map.begin(), map.end(), std::ptr_fun(&LoadEvent));
}