orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydroiceutil::EventLoop Class Reference

#include <eventloop.h>

Inherits hydroiceutil::JobQueue.

Inheritance diagram for hydroiceutil::EventLoop:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 EventLoop (gbxsickacfr::gbxutilacfr::Tracer &tracer, const JobQueue::Config &config=JobQueue::Config())
 Constructor.
void postEvent (EventReceiver &receiver, const EventPtr &event, const std::string &signature="")
void postEvent (EventReceiver &receiver, int type, const std::string &signature="")
 Executes an EventJob which sends an Event of type type to the event receiver receiver.
void postEvent (const std::string &receiverId, const EventPtr &event, const std::string &senderId="")
void postEvent (const std::string &receiverId, int type, const std::string &senderId="")
void postEventToAll (const EventPtr &event, const std::string &senderId="")
 Posts event event to all registered receivers.
void postEventToAll (int type, const std::string &senderId="")
 Posts event of type type to all registered receivers.
void addReceiver (const std::string &receiverId, EventReceiver *receiver)
void removeReceiver (const std::string &receiverId)
EventReceiverreceiver (const std::string &receiverId)
 Returns null pointer if the specified ID is not registered.

Detailed Description

This is a convenience class which makes the JobQueue appear like an event loop. Uses specialized EventJob jobs to dispatch events through the JobQueue.

It offers a facility to store event receiver ID's which can be used later to dispatch events. All public methods utilizing the receiver registry are thread safe.


Member Function Documentation

void EventLoop::addReceiver const std::string &  receiverId,
EventReceiver receiver
 

Registers receiver with specified ID. ID can be any string. If a receiver with the specified ID is already registered, it's overwritten. If you wan to check for uniqueness first, use receiver() function. It is OK to register the same receiver multiple times under different names (e.g. to create a well known alias). Throws gbxsickacfr::gbxutilacfr::Exception if receiver is a null pointer.

void EventLoop::postEvent const std::string &  receiverId,
int  type,
const std::string &  senderId = ""
 

Executes an EventJob which sends an Event of type type to the event receiver with ID receiverID. Throws ReceiverIdNotExistException if no receiver with specified ID is registered.

void EventLoop::postEvent const std::string &  receiverId,
const EventPtr event,
const std::string &  senderId = ""
 

Executes an EventJob which sends an event event to the event receiver with ID receiverID. Throws ReceiverIdNotExistException if no receiver with specified ID is registered.

void EventLoop::postEvent EventReceiver receiver,
const EventPtr event,
const std::string &  signature = ""
 

Adds the event event, with the receiver as the receiver of the event, to an event queue and returns immediately. It is not safe to modify or delete the event after it has been posted.

void EventLoop::removeReceiver const std::string &  receiverId  ) 
 

Unregisters receiver with specified ID. If a receiver with the specified ID is not registered the request is quietly ignored.


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

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5