NodeLocalMultiTargetDelayMap.cpp

Go to the documentation of this file.
00001 #include "NodeLocalMultiTargetDelayMap.h"
00002 #include <iostream>
00003 
00004 using std::cout;
00005 using std::endl;
00006 
00007 NodeLocalMultiTargetDelayMap::NodeLocalMultiTargetDelayMap()
00008 {}
00009 
00010 NodeLocalMultiTargetDelayMap::~NodeLocalMultiTargetDelayMap()
00011 {}
00012 
00013 
00014 //void NodeLocalMultiTargetDelayMap::insert(SimObject *o, engineid_t dest_eng, int delay, spikegroupid_t group)
00015 //{
00016 //    local_objectid_t localid = o->getLocalID();
00017 //    engineid_t src_eng = o->getEngineID();
00018 //    insert(src_eng, localid, dest_eng, delay, group) ;
00019 //}
00020 
00021 void NodeLocalMultiTargetDelayMap::insert(engineid_t src_eng, local_objectid_t localid,
00022         engineid_t dest_eng, delaystep_t delay, spikegroupid_t group)
00023 {
00024     //cout << "inserted into mtdelaymap src_eng=" << src_eng << ", localid=" << localid <<
00025     //           ", dest_eng=" << dest_eng << ", delay=" << delay << ", group=" << group << endl;
00026     if (src_eng >= _map.size()) _map.resize(src_eng + 1);
00027     if (localid >= _map[src_eng].size()) _map[src_eng].resize(localid + 1);
00028     if (dest_eng >= _map[src_eng][localid].size()) _map[src_eng][localid].resize(dest_eng + 1);
00029     _map[src_eng][localid][dest_eng][delay]=group;
00030 }
00031 
00032 spikegroupid_t NodeLocalMultiTargetDelayMap::find(engineid_t src_eng, local_objectid_t localid,
00033         engineid_t dest_eng, delaystep_t delay)
00034 {
00035     delaymaptype::const_iterator find_iter;
00036     if (src_eng >= _map.size()) return no_spikegroup;
00037     if (localid >= _map[src_eng].size()) return no_spikegroup;
00038     if (dest_eng >= _map[src_eng][localid].size()) return no_spikegroup;
00039 
00040     if (  (find_iter = _map[src_eng][localid][dest_eng].find(delay)) != _map[src_eng][localid][dest_eng].end() ) {
00041         return find_iter->second ;
00042     }
00043     return no_spikegroup;
00044 }
00045 
00046 NodeLocalMultiTargetDelayMap::const_iterator
00047 NodeLocalMultiTargetDelayMap::beginDelays(engineid_t src_eng, local_objectid_t localid,
00048         engineid_t dest_eng)
00049 {
00050     return _map[src_eng][localid][dest_eng].begin();
00051 }
00052 
00053 NodeLocalMultiTargetDelayMap::const_iterator NodeLocalMultiTargetDelayMap::endDelays(engineid_t src_eng,
00054         local_objectid_t localid, engineid_t dest_eng)
00055 {
00056     return _map[src_eng][localid][dest_eng].end();
00057 }
00058 
00059 int NodeLocalMultiTargetDelayMap::lastDestEngine(engineid_t src_eng, local_objectid_t localid)
00060 {
00061     // cout << "_map[src_eng][localid]" << endl;
00062     if (_map.size() > src_eng && _map[src_eng].size() > localid)
00063         return _map[src_eng][localid].size() - 1;
00064     else
00065         return -1;
00066 }
00067 
00068 //NodeLocalMultiTargetDelayMap::const_iterator NodeLocalMultiTargetDelayMap::beginDelays(SimObject *o, engineid_t dest_eng)
00069 //{
00070 //    engineid_t src_eng = o->getEngineID();
00071 //    local_objectid_t localid = o->getLocalID() ;
00072 //    return _map[src_eng][localid][dest_eng].begin();
00073 //}
00074 
00075 //NodeLocalMultiTargetDelayMap::const_iterator NodeLocalMultiTargetDelayMap::endDelays(SimObject *o, engineid_t dest_eng)
00076 //{
00077 //    engineid_t src_eng = o->getEngineID();
00078 //    local_objectid_t localid = o->getLocalID() ;
00079 //    return _map[src_eng][localid][dest_eng].end();
00080 //}

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