DHART
|
A collection of nodes that form a path. More...
#include <path.h>
Public Member Functions | |
Path::Path () | |
Construct an empty path. More... | |
Path::Path (const std::vector< PathMember > &pm) | |
Construct a path from an ordered list of PathMembers. More... | |
void | AddNode (int node, float cost) |
Add a new node to the path. More... | |
bool | empty () const |
Determine if this path has any nodes in it. More... | |
int | size () const |
Determine how many nodes are in this path. More... | |
void | Reverse () |
Reverse the direction of this path. More... | |
bool | operator== (const Path &p2) const |
Determine if this path is identical to p2. More... | |
PathMember | operator[] (int i) const |
Retrieve the node and cost in this path at index i. More... | |
PathMember * | GetPMPointer () |
Get a pointer to the path's underlying path members vector. More... | |
Public Attributes | |
std::vector< PathMember > | members |
Ordered array of PathMembers that comprise the path. More... | |
void HF::SpatialStructures::Path::AddNode | ( | int | node, |
float | cost | ||
) |
Add a new node to the path.
Constructs a PathMember and appends it to the underlying members vector.
node | The identifier for the PathMember |
cost | The cost (weight) for the PathMember |
Definition at line 12 of file path.cpp.
References members.
Referenced by HF::Pathfinding::ConstructShortestPathFromPred().
bool HF::SpatialStructures::Path::empty | ( | ) | const |
Determine if this path has any nodes in it.
Checks if the size of members is zero.
Definition at line 16 of file path.cpp.
References members.
Referenced by CreatePath().
PathMember * HF::SpatialStructures::Path::GetPMPointer | ( | ) |
Get a pointer to the path's underlying path members vector.
Definition at line 56 of file path.cpp.
References members.
Referenced by CreatePath(), GetPathInfo(), and HF::Pathfinding::InsertPathsIntoArray().
bool HF::SpatialStructures::Path::operator== | ( | const Path & | p2 | ) | const |
Determine if this path is identical to p2.
p2 | The Path to compare against this path |
Definition at line 28 of file path.cpp.
References size().
PathMember HF::SpatialStructures::Path::operator[] | ( | int | i | ) | const |
Retrieve the node and cost in this path at index i.
i | The index for the desired PathMember element within members. |
std::out_of_range | i extended past the number of nodes in the path. |
Definition at line 48 of file path.cpp.
References members.
|
inline |
Construct an empty path.
HF::SpatialStructures::Path::Path::Path | ( | const std::vector< PathMember > & | pm | ) |
Construct a path from an ordered list of PathMembers.
void HF::SpatialStructures::Path::Reverse | ( | ) |
Reverse the direction of this path.
Invokes std::reverse to reverse the contents of the underlying members vector using iterators
Definition at line 24 of file path.cpp.
References members.
Referenced by HF::Pathfinding::ConstructShortestPathFromPred().
int HF::SpatialStructures::Path::size | ( | ) | const |
Determine how many nodes are in this path.
Definition at line 20 of file path.cpp.
References members.
Referenced by HF::Pathfinding::ConstructShortestPathFromPred(), CreatePath(), GetPathInfo(), HF::Pathfinding::InsertPathsIntoArray(), std::operator<<(), and operator==().
std::vector<PathMember> HF::SpatialStructures::Path::members |
Ordered array of PathMembers that comprise the path.
Definition at line 78 of file path.h.
Referenced by AddNode(), empty(), GetPMPointer(), operator[](), Reverse(), and size().