OverSim
TriggerTable.cc
Go to the documentation of this file.
1 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 
23 #include "TriggerTable.h"
24 #include <string>
25 #include <sstream>
26 
27 using namespace std;
28 
30 
32 {
33  return 6;
34 }
35 
36 void TriggerTable::initialize(int stage)
37 {
38  if (stage != 5) return;
39 
40  I3 *i3 = check_and_cast<I3*>(getParentModule()->getSubmodule("i3"));
41  triggerTable = &i3->getTriggerTable();
42  WATCH_MAP(*triggerTable);
43  getDisplayString().setTagArg("t", 0, "0 identifiers,\n0 triggers");
44 }
45 
46 
48 {
49  ostringstream os;
50  int numTriggers = 0;
51 
52  os << triggerTable->size() << " identifiers,\n";
53 
54  I3TriggerTable::iterator it;
55  for (it = triggerTable->begin(); it != triggerTable->end(); it++) {
56  numTriggers += it->second.size();
57  }
58 
59  os << numTriggers << " triggers";
60 
61  getDisplayString().setTagArg("t", 0, os.str().c_str());
62 }