Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

/home/pauldt/projects/IDEA/IDEA-ALL/IDEA-DEV/Modules/IPC/ComRelay/Includes/IPCRelay.hh

Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 //     File: $Source: /home/cvs/ISG-Repository/IDEA-DEV/Modules/IPC/ComRelay/Includes/IPCRelay.hh,v $
00003 //      Tag: $Name: DR_01_11_06 $
00004 //      CVS: $Id: IPCRelay.hh,v 1.6 2005/12/30 22:37:18 rijsman Exp $
00005 //     Info: $CVSROOT/Idea3/Copyright.txt
00006 #ifndef HEADER_INTER_PROCESS_PROTOCOL_COMMUNICATION_RELAY_HEADER
00007 #define HEADER_INTER_PROCESS_PROTOCOL_COMMUNICATION_RELAY_HEADER
00008 
00009 #include "ComRelay.hh"
00010 
00011 namespace IDEA
00012 {
00024   typedef struct
00025   {
00026     int identifier;
00027     int nrSubMessages;
00028     int* subMessages;
00029     int parent;
00030     const char* source;
00031     const char* sourceClass;
00032     const char* sourceTimeline;
00033     const char* sourceToken;
00034     const char* parameters;
00035     const char* target;
00036     const char* targetClass;
00037     const char* targetTimeline;
00038     int externalTokenId;
00039     int earliestStart;
00040     int latestStart;
00041     int earliestEnd;
00042     int latestEnd;
00043   } IPCStartStructure;
00044 
00045 #define startMsg_IPC "StartMsg" 
00046 #define startFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,string,int,int,int,int,int}"
00047 
00054   typedef struct
00055   {
00056     int identifier;
00057     int nrSubMessages;
00058     int* subMessages;
00059     int parent;
00060     const char* source;
00061     const char* sourceClass;
00062     const char* sourceTimeline;
00063     const char* sourceToken;
00064     const char* target;
00065     const char* targetClass;
00066     const char* targetTimeline;
00067     int externalTokenId;
00068     const char* value;
00069   } IPCStopStructure;
00070 
00071 #define stopMsg_IPC "StopMsg" 
00072 #define stopFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,int,string}" 
00080   typedef struct
00081   {
00082     int identifier;
00083     int nrSubMessages;
00084     int* subMessages;
00085     int parent;
00086     const char* source;
00087     const char* sourceClass;
00088     const char* sourceTimeline;
00089     const char* sourceToken;
00090     const char* target;
00091     const char* targetClass;
00092     const char* targetTimeline;
00093     int externalTokenId;
00094     const char* value;
00095     int index;
00096   } IPCValueStructure;
00097 
00098 #define valueMsg_IPC "ValueMsg" 
00099 #define valueFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,int,string,int}" 
00107   typedef struct
00108   {
00109     int identifier;
00110     int nrSubMessages;
00111     int* subMessages;
00112     int parent;
00113     const char* source;
00114     const char* sourceClass;
00115     const char* sourceTimeline;
00116     const char* sourceToken;
00117     const char* target;
00118     const char* targetClass;
00119     const char* targetTimeline;
00120     int externalTokenId;
00121     const char* value;
00122   } IPCStatusStructure;
00123 
00124 #define statusMsg_IPC "StatusMsg" 
00125 #define statusFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,int,string}" 
00133   typedef struct
00134   {
00135     int identifier;
00136     int nrSubMessages;
00137     int* subMessages;
00138     int parent;
00139     const char* source;
00140     const char* sourceClass;
00141     const char* sourceTimeline;
00142     const char* sourceToken;
00143     const char* target;
00144     const char* targetClass;
00145     const char* targetTimeline;
00146     const char* objectName;
00147     const char* objectClass;
00148     const char* objectToken;
00149     const char* parameters;
00150   } IPCObjectStructure;
00151 
00152 #define objectMsg_IPC "ObjectMsg" 
00153 #define objectFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,string,string,string,string}" 
00161   typedef struct
00162   {
00163     int identifier;
00164     int nrSubMessages;
00165     int* subMessages;
00166     int parent;
00167     const char* source;
00168     const char* sourceClass;
00169     const char* sourceTimeline;
00170     const char* sourceToken;
00171     const char* target;
00172     const char* targetClass;
00173     const char* targetTimeline;
00174     const char* value;
00175     int index;
00176   } IPCTelemetryStructure;
00177 
00178 #define telemetryMsg_IPC "TelemetryMsg" 
00179 #define telemetryFmt_IPC "{int,int,<int: 1>,int,string,string,string,string,string,string,string,string,int}" 
00184 #define LISTEN_TIMEOUT_MSEC 100
00185 
00197   class IPCRelayListener:
00198     public Singleton<IPCRelayListener>,
00199     public ACE_Task_Base
00200   {
00201     friend class Singleton<IPCRelayListener>;
00202   public:
00206     ~IPCRelayListener();
00212     int activate(long flags=THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, int n_threads=1, int force_active=0, long priority=ACE_DEFAULT_THREAD_PRIORITY, int grp_id=-1, ACE_Task_Base *task=0, ACE_hthread_t thread_handles[]=0, void *stack[]=0, size_t stack_size[]=0, ACE_thread_t thread_ids[]=0); 
00213 
00217     void shutDown();
00218 
00222     bool isActive() const { return m_Active; }
00223 
00228     int getListenMilliSeconds() const { return m_ListenMilliSeconds; }
00229   protected:
00233     IPCRelayListener( int listenMilliSeconds = LISTEN_TIMEOUT_MSEC );
00234   private:
00238     int svc( void );
00239 
00240     int m_ListenMilliSeconds;
00241     bool m_Active;
00242   };
00243 
00259   class IPCRelay:
00260     public ComRelay
00261   {
00262   public:
00266     IPCRelay( const AgentRelay* agentRelay,
00267               const std::string& name = "IPCRelay");
00268 
00272     virtual ~IPCRelay();
00279     virtual void receivedStartMessage( const MessageHandle& msg);
00286     virtual void receivedStopMessage( const MessageHandle& msg );
00293     virtual void receivedValueMessage( const MessageHandle& msg );
00300     virtual void receivedStatusMessage( const MessageHandle& msg );
00307     virtual void receivedObjectMessage( const MessageHandle& msg );
00314     virtual void receivedTelemetryMessage( const MessageHandle& msg );
00315   protected:
00319     virtual int connect();
00327     virtual bool defineUserDefinedMessages() { return true; }
00335     virtual bool subscribeUserDefinedMessages() { return true; }
00336 
00340     virtual void updateStartMessage( const Time& time, const StartMessageData* data );
00344     virtual void updateStopMessage( const Time& time, const StopMessageData* data );
00348     virtual void updateValueMessage( const Time& time, const ValueMessageData* data );
00352     virtual void updateStatusMessage( const Time& time, const StatusMessageData* data );
00356     virtual void updateObjectMessage( const Time& time, const ObjectMessageData* data );
00360     virtual void updateTelemetryMessage( const Time& time, const TelemetryMessageData* data  );
00361   private:
00375     int initialize();
00376   
00377   
00391     bool defineMessages();
00404     bool subscribeMessages();
00405   };
00406 
00407 
00408 }
00409 
00410 #endif //HEADER_INTER_PROCESS_PROTOCOL_COMMUNICATION_RELAY_HEADER
00411 

Contact information
© IDEA
Generated on Fri Feb 3 17:09:42 2006 for IDEA.