orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
eventloop.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://!orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef HYDROICEUTIL_EVENT_LOOP_H 00012 #define HYDROICEUTIL_EVENT_LOOP_H 00013 00014 #include <gbxsickacfr/gbxutilacfr/exceptions.h> 00015 #include <hydroiceutil/eventjob.h> 00016 #include <map> 00017 00018 namespace hydroiceutil { 00019 00021 class ReceiverIdNotExistException : public gbxsickacfr::gbxutilacfr::Exception 00022 { 00023 public: 00024 ReceiverIdNotExistException(const char *file, const char *line, const char *message) 00025 : Exception( file, line, message ) {}; 00026 ReceiverIdNotExistException(const char *file, const char *line, const std::string &message) 00027 : Exception( file, line, message ) {}; 00028 }; 00029 00030 00036 class EventLoop : public JobQueue 00037 { 00038 public: 00040 EventLoop( gbxsickacfr::gbxutilacfr::Tracer& tracer, const JobQueue::Config& config=JobQueue::Config() ); 00041 00044 void postEvent( EventReceiver& receiver, const EventPtr &event, const std::string& signature="" ); 00045 00047 void postEvent( EventReceiver& receiver, int type, const std::string& signature="" ); 00048 00051 void postEvent( const std::string& receiverId, const EventPtr &event, const std::string& senderId="" ); 00052 00055 void postEvent( const std::string& receiverId, int type, const std::string& senderId="" ); 00056 00058 void postEventToAll( const EventPtr &event, const std::string& senderId="" ); 00059 00061 void postEventToAll( int type, const std::string& senderId="" ); 00062 00069 void addReceiver( const std::string& receiverId, EventReceiver* receiver ); 00070 00073 void removeReceiver( const std::string& receiverId ); 00074 00076 EventReceiver* receiver( const std::string& receiverId ); 00077 00078 private: 00079 00080 std::map<std::string,EventReceiver*> registry_; 00081 IceUtil::Mutex registryMutex_; 00082 00083 }; 00085 typedef IceUtil::Handle<EventLoop> EventLoopPtr; 00086 00087 } // namespace 00088 00089 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)