OpenASIP  2.0
StopPointManager.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file StopPointManager.hh
26  *
27  * Declaration of StopPointManager class.
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_STOP_POINT_MANAGER_HH
34 #define TTA_STOP_POINT_MANAGER_HH
35 
36 #include <vector>
37 #include <map>
38 
39 #include "Exception.hh"
40 #include "StopPoint.hh"
41 #include "SimulatorConstants.hh"
42 #include "Listener.hh"
43 
46 
47 /**
48  * Keeps book of user-set simulation stop points.
49  */
50 class StopPointManager : public Listener {
51 public:
53  TTASimulationController& controller,
54  SimulationEventHandler& eventHandler);
55 
56  virtual ~StopPointManager();
57  unsigned int add(const StopPoint& stopPoint);
58  void deleteStopPoint(unsigned int handle);
59  void deleteAll();
60 
61  void enable(unsigned int handle);
62  void enableAll();
63 
64  void enableOnceAndDelete(unsigned int handle);
65  void enableOnceAndDisable(unsigned int handle);
66 
67  void disable(unsigned int handle);
68  void disableAll();
69 
70  const StopPoint& stopPointWithHandleConst(unsigned int handle) const;
71 
72  unsigned int stopPointHandle(unsigned int index);
73  unsigned int stopPointCount();
74 
75  void setIgnore(unsigned int handle, unsigned int count);
76  void setCondition(unsigned int handle, const ConditionScript& condition);
77  void removeCondition(unsigned int handle);
78 
79  unsigned int stopCausingStopPoint(unsigned int index) const;
80  unsigned int stopCausingStopPointCount() const;
81 
82  void handleEvent();
83 
84 private:
85  /// The breakpoint storage.
86  typedef std::map<unsigned int, StopPoint*> StopPointIndex;
87  /// The handle storage.
88  typedef std::vector<unsigned int> HandleContainer;
89 
90  StopPoint* findStopPoint(unsigned int handle);
91 
92  /// The stop points.
94  /// The stop point handles.
96  /// Represents the next free handle.
97  unsigned int handleCount_;
98  /// The clock cycle in which simulation was stopped last.
100  /// The simulation controller to use to stop the simulation.
102  /// The event handler to use to register stop points to.
104 
105 };
106 
107 #endif
StopPointManager::enableOnceAndDelete
void enableOnceAndDelete(unsigned int handle)
Definition: StopPointManager.cc:172
StopPointManager::StopPointIndex
std::map< unsigned int, StopPoint * > StopPointIndex
The breakpoint storage.
Definition: StopPointManager.hh:86
StopPointManager::handleCount_
unsigned int handleCount_
Represents the next free handle.
Definition: StopPointManager.hh:97
StopPointManager::controller_
TTASimulationController & controller_
The simulation controller to use to stop the simulation.
Definition: StopPointManager.hh:101
Exception.hh
StopPointManager::add
unsigned int add(const StopPoint &stopPoint)
Definition: StopPointManager.cc:81
StopPointManager::eventHandler_
SimulationEventHandler & eventHandler_
The event handler to use to register stop points to.
Definition: StopPointManager.hh:103
StopPointManager::stopPoints_
StopPointIndex stopPoints_
The stop points.
Definition: StopPointManager.hh:93
Listener
Definition: Listener.hh:40
SimulationEventHandler
Definition: SimulationEventHandler.hh:41
StopPointManager::enableOnceAndDisable
void enableOnceAndDisable(unsigned int handle)
Definition: StopPointManager.cc:187
StopPointManager::deleteStopPoint
void deleteStopPoint(unsigned int handle)
Definition: StopPointManager.cc:108
StopPointManager::setCondition
void setCondition(unsigned int handle, const ConditionScript &condition)
Definition: StopPointManager.cc:296
SimulatorConstants.hh
StopPointManager::lastStopCycle_
ClockCycleCount lastStopCycle_
The clock cycle in which simulation was stopped last.
Definition: StopPointManager.hh:99
ConditionScript
Definition: ConditionScript.hh:45
StopPointManager::stopPointCount
unsigned int stopPointCount()
Definition: StopPointManager.cc:269
StopPointManager::stopCausingStopPoint
unsigned int stopCausingStopPoint(unsigned int index) const
Definition: StopPointManager.cc:345
TTASimulationController
Definition: TTASimulationController.hh:69
StopPointManager::StopPointManager
StopPointManager(TTASimulationController &controller, SimulationEventHandler &eventHandler)
Definition: StopPointManager.cc:56
StopPointManager::stopPointWithHandleConst
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
Definition: StopPointManager.cc:248
StopPoint
Definition: StopPoint.hh:53
StopPointManager::enable
void enable(unsigned int handle)
Definition: StopPointManager.cc:149
StopPointManager::HandleContainer
std::vector< unsigned int > HandleContainer
The handle storage.
Definition: StopPointManager.hh:88
StopPointManager
Definition: StopPointManager.hh:50
StopPointManager::deleteAll
void deleteAll()
Definition: StopPointManager.cc:136
StopPointManager::stopCausingStopPointCount
unsigned int stopCausingStopPointCount() const
Definition: StopPointManager.cc:368
StopPoint.hh
StopPointManager::disable
void disable(unsigned int handle)
Definition: StopPointManager.cc:200
StopPointManager::removeCondition
void removeCondition(unsigned int handle)
Definition: StopPointManager.cc:308
StopPointManager::disableAll
void disableAll()
Definition: StopPointManager.cc:208
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
StopPointManager::handles_
HandleContainer handles_
The stop point handles.
Definition: StopPointManager.hh:95
StopPointManager::stopPointHandle
unsigned int stopPointHandle(unsigned int index)
Definition: StopPointManager.cc:231
StopPointManager::~StopPointManager
virtual ~StopPointManager()
Definition: StopPointManager.cc:67
StopPointManager::enableAll
void enableAll()
Definition: StopPointManager.cc:157
StopPointManager::handleEvent
void handleEvent()
Definition: StopPointManager.cc:388
StopPointManager::setIgnore
void setIgnore(unsigned int handle, unsigned int count)
Definition: StopPointManager.cc:283
StopPointManager::findStopPoint
StopPoint * findStopPoint(unsigned int handle)
Definition: StopPointManager.cc:320
Listener.hh