00001 #ifndef DISTRIBUTEDANALOGMESSAGEDISPATCHER_H_ 00002 #define DISTRIBUTEDANALOGMESSAGEDISPATCHER_H_ 00003 00004 #include "AnalogMessageDispatcher.h" 00005 #include "DistributedIncomingAnalogMsgDispatcher.h" 00006 #include "DistributedOutgoingAnalogMsgDispatcher.h" 00007 #include "MTIncomingAnalogMessageDispatcher.h" 00008 #include "DistributedCycledAnalogMsgDispatcher.h" 00009 00010 00011 00012 class DistributedAnalogMessageDispatcher : public AnalogMessageDispatcher, public DistributedCycledAnalogMsgDispatcher 00013 { 00014 public: 00015 DistributedAnalogMessageDispatcher(int numNodes, 00016 int minimumDelay, 00017 vector< DistributedIncomingAnalogMsgDispatcher* > & incomingDispatchers, 00018 vector< DistributedOutgoingAnalogMsgDispatcher* > & outgoingDispatchers, 00019 AnalogMessageDispatcher &localDispatcher); 00020 00021 virtual ~DistributedAnalogMessageDispatcher(); 00022 00024 void dispatchOutgoingAnalogMsgs(); 00025 00026 void dispatchIncomingAnalogMsgs(int step); 00027 00029 // of a simulation cycle ( = minDelay steps ) 00030 virtual void dispatchDelayerCycledIncomingAnalogMsgs(); 00031 00033 virtual void dispatchAnalogMsgs(); 00034 00035 virtual void initialize(); 00036 virtual void reset(double dt); 00037 00038 vector<DistributedIncomingAnalogMsgDispatcher*> & incoming() 00039 { 00040 return incoming_dispatchers; 00041 } 00042 00043 vector<DistributedOutgoingAnalogMsgDispatcher*> & outgoing() 00044 { 00045 return outgoing_dispatchers; 00046 } 00047 00048 00049 MTIncomingAnalogMessageDispatcher & cycledLocal() 00050 { 00051 return cycledLocalDispatcher; 00052 } 00053 00054 protected: 00055 00056 int nNodes; 00057 00058 int minDelay; 00059 00060 vector< DistributedIncomingAnalogMsgDispatcher* > &incoming_dispatchers; 00061 vector< DistributedOutgoingAnalogMsgDispatcher* > &outgoing_dispatchers; 00062 00063 00064 MTIncomingAnalogMessageDispatcher cycledLocalDispatcher; 00065 00066 AnalogMessageDispatcher &local_dispatcher; 00067 00068 int currentStep; 00069 }; 00070 00071 #endif /*DISTRIBUTEDANALOGMESSAGEDISPATCHER_H_*/