00001 #ifndef MTINCOMINGANALOGMESSAGEDISPATCHER_H_
00002 #define MTINCOMINGANALOGMESSAGEDISPATCHER_H_
00003
00004 #include <vector>
00005 #include <utility>
00006 #include "pcsim_hash.h"
00007
00008 #include "hash_ext.h"
00009 #include "SimObject.h"
00010 #include "globaldefinitions.h"
00011 #include "AnalogDelayObject.h"
00012
00013
00014 using std::pair;
00015 using std::vector;
00016
00017 class MTIncomingAnalogMessageDispatcher
00018 {
00019 public:
00020 MTIncomingAnalogMessageDispatcher();
00021 virtual ~MTIncomingAnalogMessageDispatcher();
00022
00023 void addAnalogMessage(AnalogDelayObject *src, analog_port_id_t src_port, SimObject *dest, analog_port_id_t dest_port);
00024
00025 void addAnalogMessage(AnalogDelayObject *src, analog_port_id_t src_port, SimObject *dest, string srcfield);
00026
00027 void dispatchIncomingAnalogMsgs(int step);
00028
00029 void initialize();
00030
00031 protected:
00032 bool initialized;
00033
00034 typedef vector< vector< pair<SimObject *, analog_port_id_t> > > port_msg_destinations_type;
00035 port_msg_destinations_type port_msg_destinations;
00036
00037 typedef vector< pair< AnalogDelayObject *, analog_port_id_t > > msg_sources_type;
00038 msg_sources_type port_msg_sources;
00039
00040 typedef vector< vector< pair< void *, Field::ValueType> > > field_msg_destinations_type;
00041 field_msg_destinations_type field_msg_destinations;
00042
00043 msg_sources_type field_msg_sources;
00044
00045 typedef hash_map< pair<AnalogDelayObject *, analog_port_id_t>, int,
00046 PCSIM::hash< pair<AnalogDelayObject *,analog_port_id_t> > > sources_positions_type;
00047
00048 sources_positions_type *port_sources_positions;
00049
00050 sources_positions_type *field_sources_positions;
00051
00052
00053
00054 };
00055
00056 #endif