GlobalSingleTargetDelayMap.cpp

Go to the documentation of this file.
00001 #include "GlobalSingleTargetDelayMap.h"
00002 #include <iostream>
00003 
00004 using std::cout;
00005 using std::endl;
00006 
00007 GlobalSingleTargetDelayMap::GlobalSingleTargetDelayMap()
00008 {}
00009 
00010 GlobalSingleTargetDelayMap::~GlobalSingleTargetDelayMap()
00011 {}
00012 
00013 
00014 
00015 void GlobalSingleTargetDelayMap::insert(gl_engineid_t eng, local_objectid_t oid,
00016                                         delaystep_t delay, spikegroupid_t group)
00017 {
00018     //cout << "inserted into mtdelaymap src_eng=" << src_eng << ", localid=" << localid <<
00019     //           ", dest_eng=" << dest_eng << ", delay=" << delay << ", group=" << group << endl;
00020     if (eng >= _map.size()) _map.resize(eng + 1);
00021     if (_map[eng].find(delay) == _map[eng].end() )
00022         _map[eng].insert(pair<local_objectid_t, delaymaptype>(oid, delaymaptype()));
00023     _map[eng][oid][delay]=group;
00024 }
00025 
00026 spikegroupid_t GlobalSingleTargetDelayMap::find(gl_engineid_t eng, local_objectid_t oid,
00027         delaystep_t delay)
00028 {
00029     delaymaptype::const_iterator find_iter;
00030     if (eng >= _map.size())
00031         return no_spikegroup;
00032     if (_map[eng].find(oid) == _map[eng].end())
00033         return no_spikegroup;
00034     if (  (find_iter = _map[eng][oid].find(delay)) != _map[eng][oid].end() )
00035         return find_iter->second ;
00036     return no_spikegroup;
00037 }
00038 
00039 bool GlobalSingleTargetDelayMap::hasDelays(gl_engineid_t eng, local_objectid_t oid)
00040 {
00041     if (eng >= _map.size())
00042         return false;
00043     if (_map[eng].find(oid) == _map[eng].end())
00044         return false;
00045     return true;
00046 }
00047 
00048 GlobalSingleTargetDelayMap::const_iterator
00049 GlobalSingleTargetDelayMap::beginDelays(gl_engineid_t eng, local_objectid_t oid)
00050 {
00051     return _map[eng][oid].begin();
00052 }
00053 
00054 GlobalSingleTargetDelayMap::const_iterator GlobalSingleTargetDelayMap::endDelays(gl_engineid_t eng,
00055         local_objectid_t oid)
00056 {
00057     return _map[eng][oid].end();
00058 }

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