HOG2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
patrolUnit Class Reference

#include <PatrolUnit.h>

Inheritance diagram for patrolUnit:
Inheritance graph
[legend]
Collaboration diagram for patrolUnit:
Collaboration graph
[legend]

Public Member Functions

 patrolUnit (int x, int y)
 
virtual const char * GetName ()
 
virtual tDirection makeMove (MapProvider *, reservationProvider *, SimulationInfo *simInfo)
 ‍** Creates a patrol unit and assigns it numPLocations random locations to patrol. More...
 
void OpenGLDraw (const MapProvider *, const SimulationInfo *) const
 
void addPatrolLocation (unit *)
 
unit * GetGoal ()
 
void updateLocation (int _x, int _y, bool worked, SimulationInfo *)
 
void LogStats (StatCollection *stats)
 log an stats that may have been computed during the last run More...
 
void LogFinalStats (StatCollection *stats)
 log any final one-time stats before a simulation is ended More...
 
- Public Member Functions inherited from Unit< state, action, environment >
 Unit ()
 
virtual ~Unit ()
 
virtual bool MakeMove (environment *, OccupancyInterface< state, action > *, SimulationInfo< state, action, environment > *, action &a)=0
 
virtual void UpdateLocation (environment *, state &, bool success, SimulationInfo< state, action, environment > *)=0
 
virtual void GetLocation (state &)=0
 
virtual void OpenGLDraw (const environment *, const SimulationInfo< state, action, environment > *) const =0
 
virtual void GetGoal (state &s)
 
virtual bool Done ()
 
virtual double GetSpeed ()
 
void SetSpeed (double s)
 
virtual void SetColor (GLfloat _r, GLfloat _g, GLfloat _b)
 
virtual void GetColor (GLfloat &_r, GLfloat &_g, GLfloat &_b) const
 
UnitGroup< state, action, environment > * GetUnitGroup ()
 
void SetUnitGroup (UnitGroup< state, action, environment > *_group)
 
virtual unsigned int GetNum ()
 
virtual void SetNum (unsigned int num)
 
virtual void StartNewTrial (StatCollection *)
 
virtual int GetPriority ()
 
virtual void SetPriority (int val)
 

Private Member Functions

double goToLoc (MapAbstraction *aMap, int which)
 
void addPathToCache (path *p)
 

Private Attributes

std::vector< tDirectionmoves
 
std::vector< unit * > Locs
 
aStar a
 
int currTarget
 
uint64_t nodesExpanded
 
uint64_t nodesTouched
 

Detailed Description

Definition at line 19 of file PatrolUnit.h.

Constructor & Destructor Documentation

◆ patrolUnit()

patrolUnit::patrolUnit ( int  x,
int  y 
)

Definition at line 15 of file PatrolUnit.cpp.

References currTarget, nodesExpanded, and nodesTouched.

Member Function Documentation

◆ addPathToCache()

void patrolUnit::addPathToCache ( path p)
private

Definition at line 125 of file PatrolUnit.cpp.

References node::GetLabelL(), GetName(), kE, GraphAbstractionConstants::kFirstData, kN, kS, kStay, kW, moves, path::n, and path::next.

Referenced by goToLoc().

◆ addPatrolLocation()

void patrolUnit::addPatrolLocation ( unit *  ru)

Definition at line 112 of file PatrolUnit.cpp.

References currTarget, and Locs.

◆ GetGoal()

unit * patrolUnit::GetGoal ( )

Definition at line 118 of file PatrolUnit.cpp.

References currTarget, and Locs.

◆ GetName()

virtual const char* patrolUnit::GetName ( )
inlinevirtual

Implements Unit< state, action, environment >.

Definition at line 23 of file PatrolUnit.h.

Referenced by addPathToCache(), and LogStats().

◆ goToLoc()

double patrolUnit::goToLoc ( MapAbstraction *  aMap,
int  which 
)
private

◆ LogFinalStats()

void patrolUnit::LogFinalStats ( StatCollection )
virtual

log any final one-time stats before a simulation is ended

Reimplemented from Unit< state, action, environment >.

Definition at line 189 of file PatrolUnit.cpp.

References a, and SearchAlgorithm::LogFinalStats().

◆ LogStats()

void patrolUnit::LogStats ( StatCollection )
virtual

log an stats that may have been computed during the last run

Reimplemented from Unit< state, action, environment >.

Definition at line 173 of file PatrolUnit.cpp.

References StatCollection::AddStat(), GetName(), nodesExpanded, and nodesTouched.

◆ makeMove()

tDirection patrolUnit::makeMove ( MapProvider mp,
reservationProvider ,
SimulationInfo simInfo 
)
virtual

‍** Creates a patrol unit and assigns it numPLocations random locations to patrol.

Definition at line 40 of file PatrolUnit.cpp.

References currTarget, MapProvider::GetMapAbstraction(), goToLoc(), kStay, Locs, and moves.

◆ OpenGLDraw()

void patrolUnit::OpenGLDraw ( const MapProvider mp,
const SimulationInfo  
) const

◆ updateLocation()

void patrolUnit::updateLocation ( int  _x,
int  _y,
bool  worked,
SimulationInfo  
)
inline

Definition at line 28 of file PatrolUnit.h.

References currTarget, and moves.

Member Data Documentation

◆ a

aStar patrolUnit::a
private

Definition at line 37 of file PatrolUnit.h.

Referenced by goToLoc(), and LogFinalStats().

◆ currTarget

int patrolUnit::currTarget
private

Definition at line 39 of file PatrolUnit.h.

Referenced by addPatrolLocation(), GetGoal(), makeMove(), patrolUnit(), and updateLocation().

◆ Locs

std::vector<unit *> patrolUnit::Locs
private

Definition at line 36 of file PatrolUnit.h.

Referenced by addPatrolLocation(), GetGoal(), goToLoc(), and makeMove().

◆ moves

std::vector<tDirection> patrolUnit::moves
private

Definition at line 35 of file PatrolUnit.h.

Referenced by addPathToCache(), makeMove(), OpenGLDraw(), and updateLocation().

◆ nodesExpanded

uint64_t patrolUnit::nodesExpanded
private

Definition at line 40 of file PatrolUnit.h.

Referenced by goToLoc(), LogStats(), and patrolUnit().

◆ nodesTouched

uint64_t patrolUnit::nodesTouched
private

Definition at line 41 of file PatrolUnit.h.

Referenced by goToLoc(), LogStats(), and patrolUnit().


The documentation for this class was generated from the following files: