HOG2
SimulationInfo.h
Go to the documentation of this file.
1 #include <vector>
2 #include "UnitSimulation.h"
3 
4 #ifndef SIMULATIONINFO_H
5 #define SIMULATIONINFO_H
6 
7 
8 template<class state, class action, class environment>
10 
12 template<class state, class action, class environment>
14 public:
15  //SimulationInfo( std::vector<PublicUnitInfo<state,action,environment> > unitinfos, std::vector<std::vector<unsigned int> > unitsingroups, double currTime );
16  // copy operator
17  //SimulationInfo( SimulationInfo<state,action,environment> *sim );
18  //SimulationInfo();
19 
20  virtual ~SimulationInfo() { /*unitinfos.clear();*/ }
21  virtual double GetSimulationTime() const = 0;
22 
23  virtual unsigned int GetNumUnits() const = 0;
24  virtual void GetPublicUnitInfo( unsigned int unitnum, PublicUnitInfo<state,action,environment> & ) const = 0;
25  //{ return &(unitinfos[unitnum]); }
26 
27  virtual unsigned int GetNumUnitGroups() const = 0;
28  virtual unsigned int GetCurrentUnit() const = 0;
29 
30  virtual StatCollection *GetStats() = 0;
31 // virtual std::vector<unsigned int> GetUnitGroupMembers( unsigned int unitgroupnum ) {
32 // return unitsingroups[unitgroupnum];
33 // }
34 
35 // std::vector<PublicUnitInfo<state,action,environment> > unitinfos;
36 // std::vector<std::vector<unsigned int> > unitsingroups;
37 // double currentTime;
38 };
39 
40 template<class state, class action, class environment>
41 class PublicUnitInfo {
42 public:
44  PublicUnitInfo(state &_startState, state &_currentState, state &_lastState,
45  action _lastMove, double _lastTime, double _nextTime)
46  :startState(_startState), currentState(_currentState), lastState(_lastState),
47  lastMove(_lastMove), lastTime(_lastTime), nextTime(_nextTime)
48  { }
49  void init(state &_startState, state &_currentState, state &_lastState,
50  action _lastMove, double _lastTime, double _nextTime)
51  {
52  startState = _startState;
53  currentState = _currentState;
54  lastState = _lastState;
55  lastMove = _lastMove;
56  lastTime = _lastTime;
57  nextTime = _nextTime;
58  }
59 
60  state startState;
61  state currentState;
62  state lastState;
63  action lastMove;
64 
65  double lastTime;
66  double nextTime;
67 };
68 //
69 //template<class state, class action, class environment>
70 //SimulationInfo<state,action,environment>::SimulationInfo():
71 // currentTime(0.)
72 //{ };
73 //
74 //template<class state, class action, class environment>
75 //SimulationInfo<state,action,environment>::SimulationInfo( std::vector<PublicUnitInfo<state,action,environment> > _unitinfos, std::vector<std::vector<unsigned int> > _unitsingroups, double _currTime ):
76 // unitinfos(_unitinfos), unitsingroups(_unitsingroups), currentTime(_currTime)
77 //{ };
78 //
79 //template<class state, class action, class environment>
80 //SimulationInfo<state,action,environment>::SimulationInfo( SimulationInfo<state,action,environment> *sim ) {
81 // unitinfos = sim->unitinfos;
82 // unitsingroups = sim->unitsingroups;
83 // currentTime = sim->currentTime;
84 //};
85 
86 
87 #endif
UnitSimulation.h
SimulationInfo
Definition: SimulationInfo.h:13
PublicUnitInfo::PublicUnitInfo
PublicUnitInfo(state &_startState, state &_currentState, state &_lastState, action _lastMove, double _lastTime, double _nextTime)
Definition: SimulationInfo.h:44
SimulationInfo::GetSimulationTime
virtual double GetSimulationTime() const =0
PublicUnitInfo::nextTime
double nextTime
Definition: SimulationInfo.h:66
PublicUnitInfo::currentState
state currentState
Definition: SimulationInfo.h:61
SimulationInfo::GetNumUnitGroups
virtual unsigned int GetNumUnitGroups() const =0
PublicUnitInfo::lastMove
action lastMove
Definition: SimulationInfo.h:63
SimulationInfo::GetNumUnits
virtual unsigned int GetNumUnits() const =0
PublicUnitInfo::init
void init(state &_startState, state &_currentState, state &_lastState, action _lastMove, double _lastTime, double _nextTime)
Definition: SimulationInfo.h:49
SimulationInfo::GetStats
virtual StatCollection * GetStats()=0
PublicUnitInfo::lastState
state lastState
Definition: SimulationInfo.h:62
PublicUnitInfo::startState
state startState
Definition: SimulationInfo.h:60
SimulationInfo::GetPublicUnitInfo
virtual void GetPublicUnitInfo(unsigned int unitnum, PublicUnitInfo< state, action, environment > &) const =0
StatCollection
The StatCollection class is for collecting stats across different parts of the simulation.
Definition: StatCollection.h:34
SimulationInfo::~SimulationInfo
virtual ~SimulationInfo()
Definition: SimulationInfo.h:20
PublicUnitInfo::PublicUnitInfo
PublicUnitInfo()
Definition: SimulationInfo.h:43
PublicUnitInfo::lastTime
double lastTime
Definition: SimulationInfo.h:65
SimulationInfo::GetCurrentUnit
virtual unsigned int GetCurrentUnit() const =0
PublicUnitInfo
Definition: SimulationInfo.h:9