00001 #ifndef __EVENTDISTRIBUTORROOT_H__ 00002 #define __EVENTDISTRIBUTORROOT_H__ 00003 00004 /***************************************************************************** 00005 * Class: EventDistributorRoot 00006 * Author: dlemmerm 00007 * Date: 5/31/03 00008 * Purpose: This class is responsible for reading GLUE events from normal sources, 00009 * (e.g. VRPN), packing these into a buffer, then when the Client nodes 00010 * are ready to process this buffer, this class broadcasts the packed 00011 * buffer and continues to pack new events. 00012 ******************************************************************************/ 00013 00014 // Superclasses 00015 #include "EventDistributor.H" 00016 #include <event/event.H> 00017 00018 class EventDistributorRoot : public EventDistributor, public EVENThandler 00019 { 00020 public: 00021 EventDistributorRoot( str_ptr host ); 00022 virtual ~EventDistributorRoot(); 00023 00024 // Inherited from EventDistributor 00025 virtual bool init( int argc, char **argv ); 00026 virtual void loop(); 00027 virtual void term(); 00028 00029 // Inherited from EVENThandler 00030 virtual void handle_event( cEVENTptr &e ); 00031 00032 protected: 00033 static unsigned char AND_IDENTITY; 00034 00035 // This stores the offset in the event buffer that we are currently writing to 00036 int _current_buffer_pos; 00037 00038 // This flag is true if the buffer has been filled. Don't keep trying to fill. 00039 00040 bool _dont_pack_more_until_bcast; 00041 00042 public: 00043 static EventDistributorRoot *instance() { return _instance; } 00044 protected: 00045 static EventDistributorRoot *_instance; 00046 }; 00047 00048 00049 00050 #endif