LocalDelayMap.h

Go to the documentation of this file.
00001 #ifndef TARGETDELAYMAP_H_
00002 #define TARGETDELAYMAP_H_
00003 
00004 #include <vector>
00005 #include <map>
00006 #include "globaldefinitions.h"
00007 #include "SimObject.h"
00008 
00009 using std::map;
00010 using std::vector;
00011 
00013 
00028 class LocalDelayMap
00029 {
00030 
00031 
00032 public:
00033     typedef map<delaystep_t, spikegroupid_t> delaymaptype;
00034 
00035     // Iterator type for iterating through (delay, stg) pairs
00036     typedef delaymaptype::const_iterator const_iterator;
00037 
00038     LocalDelayMap() {};
00039 
00040     virtual ~LocalDelayMap() {};
00041 
00043     inline void insert(local_objectid_t localid, delaystep_t delay, spikegroupid_t group)
00044     {
00045         resize( localid );
00046         _map[localid].insert( delaymaptype::value_type(delay, group) );
00047     }
00048 
00050 
00053     spikegroupid_t find(local_objectid_t oid, delaystep_t delay);
00054 
00056     inline const_iterator beginDelays(local_objectid_t localid)
00057     {
00058         resize( localid );
00059         return _map[localid].begin();
00060     };
00061 
00063     inline const_iterator endDelays(local_objectid_t localid)
00064     {
00065         resize( localid );
00066         return _map[localid].end();
00067     };
00068 
00069 protected :
00070 
00071     inline void resize( local_objectid_t localid )
00072     {
00073         if (localid >= _map.size()) {
00074             _map.resize(localid+1);
00075         }
00076     };
00077 
00078     // data structure used for holding the mapping: [localid]->(delay, stg)
00079     vector< delaymaptype > _map;
00080 
00081 };
00082 
00083 #endif /*TARGETDELAYMAP_H_*/

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