SingleThreadNetwork.h

Go to the documentation of this file.
00001 #ifndef SINGLETHREADNETWORK_H_
00002 #define SINGLETHREADNETWORK_H_
00003 
00004 //PropagatedSpikeBuffer
00005 //TargetDelayMap
00006 
00007 #include "SimObject.h"
00008 #include "SimParameter.h"
00009 #include "SimNetwork.h"
00010 #include "PCSIMException.h"
00011 #include "SimObjectPool.h"
00012 #include "SingleThreadSpikeScheduler.h"
00013 #include "SingleThreadSimEngine.h"
00014 #include "SingleThreadAnalogMsgDispatcher.h"
00015 #include "AnalogDelayObjectMap.h"
00016 #include "AnalogDelayObject.h"
00017 #include "STAnalogMessageCreator.h"
00018 
00019 class LocalDelayMap;
00020 class SpikeTargetGroupPool;
00021 
00022 
00024 class SingleThreadNetwork : public SimNetwork
00025 {
00026 
00027 public:
00028 
00029     SingleThreadNetwork( SimParameter sp = SimParameter::Default );
00030     SingleThreadNetwork( MPI::Intracomm &mpiCommunicator, SimParameter sp = SimParameter::Default );
00031 
00032     virtual ~SingleThreadNetwork();
00033 
00034     //
00036 
00037 
00038   protected:
00040 
00044     virtual void _addObject_( const SimObjectFactory &objFactory, const SimEngine::ID &loc, SimObject::ID &oid );
00045 
00046   public:
00048     virtual void setDistributionStrategy( const DistributionStrategy::DistributionFunction &df )
00049     {
00050         /* NOTHING TO DO HERE */
00051     };
00052 
00053   protected:
00055     virtual void _addObject_( const SimObjectFactory &objFactory, SimObject::ID &gid );
00056 
00058 
00059     //
00061 
00062 
00064 
00065     virtual void _addSpikeMessage_(const SimObject::ID &sender, const port_t out, const SimObject::ID &receiver, const port_t in, const Time &delay);
00066 
00067     virtual void _addAnalogMessage_(const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, int recv_port, const Time &delay);
00068 
00069     virtual void _addAnalogMessage_(const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, string destfield, const Time &delay);
00070 
00071     virtual void _addAnalogMessage_(const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, int recv_port, const Time &delay);
00072 
00073     virtual void _addAnalogMessage_(const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, string destfield, const Time &delay);
00074 
00075     virtual SimObject *_getObject_(const SimObject::ID &id);
00076 
00078 
00079     //
00081 
00082 
00084     // virtual gl_engineid_t maxGlobalEngineID(void) const;
00085 
00087     virtual gl_engineid_t maxLocalEngineID(void) const { return 0; };
00088 
00090 
00091 protected:
00092 
00093     friend class MultiThreadNetwork;
00094     friend class DistributedSingleThreadNetwork;
00095     friend class DistributedMultiThreadNetwork;
00096 
00097     virtual void _initialize_();
00098 
00099     virtual void _reset_();
00100 
00101     virtual void _advance_( int nSteps = 1 );
00102 
00104     virtual void _insert_( const SimObjectFactory &objFactory, const SimObject::ID &container, SimObject::ID &gid );
00105 
00107     virtual void _mount_( const SimObjectFactory &objFactory, const SimObject::ID &mountpoint, SimObject::ID &gid );
00108 
00110     /* The type of connection (spike or analog) is determined (guessed) automatically.
00111      * If delay < 0 then the value returned by the destination objects getManagedDelay() method is used.
00112      * If a positive value is specified this value overwrites the dstobj.getManagedDelay() value.
00113      * */
00114     virtual void _connect_( SimObject::ID const& src, port_t out, const SimObject::ID &dst, port_t in, int delay );
00115 
00116     static void addLocalSpikeMessage(
00117         LocalDelayMap *arg_delayMap, SpikeTargetGroupPool *arg_stgPool, SimEngine *arg_simEng,
00118         const spike_port_id_t sender_port, const SimObject::ID &receiver, port_t in_port, step_t delay
00119     );
00120 
00121     virtual void seed_noise_rng( uint32 noiseRNGseed );
00122     
00123     // void addIntraEngineSpikeMessage( spike_port_id_t sender_port, object_type_t rec_type, local_objectid_t rec_oid, port_t in_port, delay_t delay );
00124 
00125 private:
00126 
00127     void init();
00128 
00129     PropagatedSpikeBuffer *spikeBuffer;
00130     LocalDelayMap *delayMap;
00131     SingleThreadSpikeScheduler *spikeScheduler;
00132 
00133     SingleThreadAnalogMsgDispatcher *analogMsgDispatcher;
00134     AnalogDelayObjectMap *analogDelayObjectsMap;
00135 
00136     SingleThreadSimEngine *simEngine;
00137     SpikeTargetGroupPool *stgPool;
00138 
00139     DistributionStrategy::LocalRoundRobin localRoundRobin;
00140 
00141     STAnalogMessageCreator * analogMsgCreator;
00142 
00143 };
00144 
00145 #endif /*SINGLETHREADNETWORK_H_*/

Generated on Wed Jul 9 16:34:38 2008 for PCSIM by  doxygen 1.5.5