TriggerTable.cc

Go to the documentation of this file.
00001 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00002 //
00003 // This program is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU General Public License
00005 // as published by the Free Software Foundation; either version 2
00006 // of the License, or (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016 //
00017 
00023 #include "TriggerTable.h"
00024 #include <string>
00025 #include <sstream>
00026 
00027 using namespace std;
00028 
00029 Define_Module(TriggerTable);
00030 
00031 int TriggerTable::numInitStages() const
00032 {
00033     return 6;
00034 }
00035 
00036 void TriggerTable::initialize(int stage)
00037 {
00038     if (stage != 5) return;
00039 
00040     I3 *i3 = check_and_cast<I3*>(getParentModule()->getSubmodule("i3"));
00041     triggerTable = &i3->getTriggerTable();
00042     WATCH_MAP(*triggerTable);
00043     getDisplayString().setTagArg("t", 0, "0 identifiers,\n0 triggers");
00044 }
00045 
00046 
00047 void TriggerTable::updateDisplayString()
00048 {
00049     ostringstream os;
00050     int numTriggers = 0;
00051 
00052     os << triggerTable->size() << " identifiers,\n";
00053 
00054     I3TriggerTable::iterator it;
00055     for (it = triggerTable->begin(); it != triggerTable->end(); it++) {
00056         numTriggers += it->second.size();
00057     }
00058 
00059     os << numTriggers << " triggers";
00060 
00061     getDisplayString().setTagArg("t", 0, os.str().c_str());
00062 }
Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3