INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide 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-2009 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 <gbxutilacfr/exceptions.h> 00015 #include <hydroiceutil/eventjob.h> 00016 #include <map> 00017 00018 namespace hydroiceutil { 00019 00021 class ReceiverIdNotExistException : public 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 00044 class EventLoop : public JobQueue 00045 { 00046 public: 00048 EventLoop( gbxutilacfr::Tracer& tracer, const JobQueue::Config& config=JobQueue::Config() ); 00049 00052 void postEvent( EventReceiver& receiver, const EventPtr &event, const std::string& signature="", bool debug=false ); 00053 00055 void postEvent( EventReceiver& receiver, int type, const std::string& signature="", bool debug=false ); 00056 00059 void postEvent( const std::string& receiverId, const EventPtr &event, const std::string& senderId="", bool debug=false ); 00060 00063 void postEvent( const std::string& receiverId, int type, const std::string& senderId="", bool debug=false ); 00064 00066 void postEventToAll( const EventPtr &event, const std::string& senderId="", bool debug=false ); 00067 00069 void postEventToAll( int type, const std::string& senderId="", bool debug=false ); 00070 00077 void addReceiver( const std::string& receiverId, EventReceiver* receiver ); 00078 00081 void removeReceiver( const std::string& receiverId ); 00082 00084 EventReceiver* receiver( const std::string& receiverId ); 00085 00086 private: 00087 00088 std::map<std::string,EventReceiver*> registry_; 00089 IceUtil::Mutex registryMutex_; 00090 00091 }; 00093 typedef IceUtil::Handle<EventLoop> EventLoopPtr; 00094 00095 } // namespace 00096 00097 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)