本文整理汇总了C++中EventPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ EventPtr::get方法的具体用法?C++ EventPtr::get怎么用?C++ EventPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventPtr
的用法示例。
在下文中一共展示了EventPtr::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
bool EventComparator::operator() (EventPtr& evt1, EventPtr& evt2)
{
if (!evt1.get()) return true;
if (!evt2.get()) return false;
// The more or less standard definition for a priority queue
// assigns more priority to values with lower numbers.
// However, the STL implementation does the opposite.
// To stick with the more familiar convention, the comparison operator
// used for this method is > instead of <, so that the queue ordering
// gets reversed.
return evt1->getPriority()>evt2->getPriority();
}
示例2: addForwardingSlot
UUID SubgraphNode::addForwardingSlot(const UUID& internal_uuid, const TokenDataConstPtr& type, const std::string& label)
{
graph_->registerUUID(internal_uuid);
EventPtr relay = createInternalEvent(type, internal_uuid, label);
auto cb = [relay](const TokenConstPtr& data) {
relay->triggerWith(std::make_shared<Token>(*data));
relay->message_processed(relay);
};
Slot* external_slot = VariadicSlots::createVariadicSlot(type, label, cb, false, false);
relay->message_processed.connect(std::bind(&Slot::notifyEventHandled, external_slot));
crossConnectLabelChange(external_slot, relay.get());
external_to_internal_events_[external_slot->getUUID()] = relay;
relay_to_external_slot_[internal_uuid] = external_slot->getUUID();
forwarding_connector_added(relay);
return external_slot->getUUID();
}
示例3: threadMethod
void* DemoStateMachine::threadMethod(void* userArgs)
{
cout << "DemoStateMachine, internal thread started ..." << endl;
bool terminate = false;
initialize();
while(!terminate && !isFinalized())
{
if(eventQueue.waitForEvents())
{
if(!eventQueue.empty())
{
cout << "DemoStateMachine, received event ..." << endl;
EventPtr eventPtr = eventQueue.front();
eventQueue.pop_front();
if(dynamic_cast<InputEvent*>(eventPtr.get()))
{
sttcl::RefCountPtr<InputEvent> inputEvent(eventPtr);
cout << "Sending command from input '" << inputEvent->getInput() << "'" << std::endl;
terminate = cmdInterpreter->sendCmd(inputEvent->getInput(),inputEvent);
}
else if(dynamic_cast<SubStateMachineCompletedEvent*>(eventPtr.get()))
{
sttcl::RefCountPtr<SubStateMachineCompletedEvent> subStateMachineCompletedEvent(eventPtr);
cout << "DemoStateMachine, sub statemachine completed, finalizing ..." << endl;
cout << "*** Press <ENTER> once more to end the program ***" << endl;
finalize();
}
}
}
}
{ AutoLocker<SttclMutex<> > lock(threadMutex);
terminated = true;
}
cout << "DemoStateMachine, internal thread exiting ..." << endl;
if(!isFinalized())
{
finalize();
}
return 0;
}
示例4: dispatchEvent
inline void Simulator::dispatchEvent(EventPtr event)
{
assert(event.get() != 0);
SimTime fireTime = event->getFireTime();
assert(m_clock <= fireTime);
m_clock = fireTime;
event->execute();
}
示例5: _on_mouse_move
void Impl_CameraController_FirstPerson::_on_mouse_move(EventPtr pEvent)
{
Event_MouseState* pState = (Event_MouseState*)pEvent.get();
float dx = pState->mouse_state->dx;
float dy = pState->mouse_state->dy;
UpdateRotating(dx, dy);
}
示例6: updateObject
/*!
* Method called by Application::handleMessage if object already exists.
*/
void VsMagnitude::updateObject(const string &parentID, Object *obj) {
EventPtr event = Event::Cast(obj);
if ( event ) {
SEISCOMP_DEBUG("Event updated");
// Get the already cached event instance and not the temporary instance
// in the message
event = _cache.get<Event>(event->publicID());
handleEvent(event.get());
return;
}
}
示例7: processEvents
/*!
\brief Process all events in the cache
*/
void VsMagnitude::processEvents() {
_lastProcessingTime = _currentTime;
VsEvents::iterator it;
for ( it = _events.begin(); it != _events.end(); ) {
VsEvent *evt = it->second.get();
EventPtr event = _cache.get<Event>(it->first);
if ( event != NULL ) {
if ( _currentTime < evt->expirationTime ) {
process(evt, event.get());
// only send the message / update the database if the event has a VS magnitude
if ( evt->vsMagnitude ) {
evt->update++;
updateVSMagnitude(event.get(), evt);
}
} else {
process(evt, event.get());
// only send the message / update the database if the event has a VS magnitude
if ( evt->vsMagnitude )
updateVSMagnitude(event.get(), evt);
_events.erase(it++);
_publishedEvents[event->publicID()] = _currentTime;
SEISCOMP_LOG(_processingInfoChannel,
"Processing of event %s is finished.", event->publicID().c_str());
// erase outdated events
EventIDBuffer::iterator cev;
for ( cev = _publishedEvents.begin();
cev != _publishedEvents.end(); ) {
if ( cev->second
< (_currentTime - Core::TimeSpan(_timeout)) ) {
_publishedEvents.erase(cev++);
continue;
}
++cev;
}
continue;
}
} else
SEISCOMP_WARNING("%s: event not found", it->first.c_str());
++it;
}
}
示例8: _on_key
void Impl_CameraController_FirstPerson::_on_key(EventPtr pEvent)
{
using namespace math;
Event_KeyboardState* pState = (Event_KeyboardState*)pEvent.get();
m_forward = pState->keyboard_state->KeyDown(key_w);
m_backward = pState->keyboard_state->KeyDown(key_s);
m_left = pState->keyboard_state->KeyDown(key_a);
m_right = pState->keyboard_state->KeyDown(key_d);
}
示例9: onPointingMoving
///
/// タッチ点移動イベントハンドラ
void Button::onPointingMoving(
const EventPtr eve
) {
// 最初のタッチで触ってない場合は無反応
if (!first_touch_) {
return;
}
auto move_event = static_cast<const event::PointingMovingEvent*>(eve.get());
if (isHitPointRectangle(move_event->position(), hit_area_)) {
hover();
}
else {
unhover();
}
}
示例10: onPointingTrigger
///
/// トリガイベントハンドラ
void Button::onPointingTrigger(
const EventPtr eve
) {
if (!sprite_) {
// スプライトの設定がまだ
return;
}
// スプライトがアクティブじゃない場合スキップ
if (!sprite_->isVisible()) {
return;
}
auto trg_event = static_cast<const event::PointingTriggeredEvent*>(eve.get());
if (isHitPointRectangle(trg_event->position(), hit_area_)) {
// ファーストタッチで触っていた
first_touch_ = true;
hover();
}
}
示例11: eventThread
void AbstractDevice::eventThread() {
ADR_GUARD("AbstractDevice::eventThread");
m_thread_exists = true;
while (!m_thread_should_die) {
m_event_mutex.lock();
while (m_events.empty()) {
m_events_available.wait(m_event_mutex, 1);
if (m_thread_should_die) {
break;
}
}
if (m_thread_should_die) {
m_event_mutex.unlock();
break;
}
// Make a local copy of the events so they can be processed without
// leaving the mutex locked.
EventQueue events = m_events;
// Queues don't support clear(). o_o
while (!m_events.empty()) {
m_events.pop();
}
m_event_mutex.unlock();
// Process the events.
while (!events.empty()) {
EventPtr event = events.front();
events.pop();
processEvent(event.get());
}
}
m_thread_exists = false;
}
示例12: _on_resize
void DebugPanel::_on_resize(EventPtr pEvent)
{
Event_ResizeFrameBuffer* pResize = (Event_ResizeFrameBuffer*)pEvent.get();
m_pOverlay->Resize(pResize->w, pResize->h / 2);
}