Public Member Functions | List of all members
ignition::rndf::Perimeter Class Reference

Abstraction for representing a perimeter as a collection of perimeter points. More...

#include <Perimeter.hh>

Public Member Functions

 Perimeter ()
 Default constructor. More...
 
 Perimeter (const Perimeter &_other)
 Copy constructor. More...
 
virtual ~Perimeter ()
 Destructor. More...
 
bool AddExit (const Exit &_newExit)
 Add a new exit. More...
 
bool AddPoint (const rndf::Waypoint &_newWaypoint)
 Add a new perimeter point. More...
 
std::vector< Exit > & Exits ()
 Get a mutable reference to the vector of exits. More...
 
const std::vector< Exit > & Exits () const
 Get the vector of stops. More...
 
bool Load (std::ifstream &_rndfFile, const int _zoneId, int &_lineNumber)
 Parsing. More...
 
unsigned int NumExits () const
 Exits. More...
 
unsigned int NumPoints () const
 Perimeter points. More...
 
bool operator!= (const Perimeter &_other) const
 Inequality. More...
 
Perimeteroperator= (const Perimeter &_other)
 Assignment operator. More...
 
bool operator== (const Perimeter &_other) const
 Operators. More...
 
bool Point (const int _wpId, rndf::Waypoint &_wp) const
 Get the details of one of the points with Id _wpId. More...
 
std::vector< rndf::Waypoint > & Points ()
 Get a mutable reference to the vector of perimeter points. More...
 
const std::vector< rndf::Waypoint > & Points () const
 Get the vector of perimeter points. More...
 
bool RemoveExit (const Exit &_exit)
 Remove an existing exit. More...
 
bool RemovePoint (const int _wpId)
 Remove an existing perimeter point. More...
 
bool UpdatePoint (const rndf::Waypoint &_wp)
 Update an existing point. More...
 
bool Valid () const
 Validation. More...
 

Detailed Description

Abstraction for representing a perimeter as a collection of perimeter points.

A perimeter point can be tagged as "exit" if it's posible to leave the zone (represented by the perimeter) and jump to a different segment.

Constructor & Destructor Documentation

ignition::rndf::Perimeter::Perimeter ( )

Default constructor.

See also
Valid.
ignition::rndf::Perimeter::Perimeter ( const Perimeter _other)

Copy constructor.

Parameters
[in]_otherOther segment to copy from.
See also
Valid.
virtual ignition::rndf::Perimeter::~Perimeter ( )
virtual

Destructor.

Member Function Documentation

bool ignition::rndf::Perimeter::AddExit ( const Exit _newExit)

Add a new exit.

Parameters
[in]_newExitThe exit to add.
Returns
True when the exit was successfully added or false otherwise (e.g. if the exit was already existing or invalid).
bool ignition::rndf::Perimeter::AddPoint ( const rndf::Waypoint _newWaypoint)

Add a new perimeter point.

Parameters
[in]_newWaypointA new waypoint to be added.
Returns
True when the waypoint was successfully added to the list or false otherwise (e.g. if the Id of the waypoint was already existing or invalid).
std::vector<Exit>& ignition::rndf::Perimeter::Exits ( )

Get a mutable reference to the vector of exits.

Returns
A mutable reference to the vector of exits.
const std::vector<Exit>& ignition::rndf::Perimeter::Exits ( ) const

Get the vector of stops.

The elements are waypoint Ids.

Returns
The vector of stops.
bool ignition::rndf::Perimeter::Load ( std::ifstream &  _rndfFile,
const int  _zoneId,
int &  _lineNumber 
)

Parsing.

Load a perimeter from an input stream coming from a text file. The expected format is the one specified on the RNDF spec.

Parameters
[in,out]_rndfFileInput file stream.
[in]_zoneIdThe zone Id in which the perimeter is located.
[in,out]_lineNumberLine number pointed by the stream position indicator.
Returns
True if a perimeter block was found and parsed or false otherwise (e.g.: EoF or incorrect format found).
unsigned int ignition::rndf::Perimeter::NumExits ( ) const

Exits.

Get the number of exits stored.

Returns
The number of exits in the current lane.
unsigned int ignition::rndf::Perimeter::NumPoints ( ) const

Perimeter points.

Get the number of perimeter points stored.

Returns
The number of perimeter points in the current perimeter.
bool ignition::rndf::Perimeter::operator!= ( const Perimeter _other) const

Inequality.

Parameters
[in]_otherPerimeter to check for inequality.
Returns
true if this != _other
Perimeter& ignition::rndf::Perimeter::operator= ( const Perimeter _other)

Assignment operator.

Parameters
[in]_otherThe new perimeter.
Returns
A reference to this instance.
bool ignition::rndf::Perimeter::operator== ( const Perimeter _other) const

Operators.

Equality operator, result = this == _other

Parameters
[in]_otherPerimeter to check for equality.
Returns
true if this == _other
bool ignition::rndf::Perimeter::Point ( const int  _wpId,
rndf::Waypoint _wp 
) const

Get the details of one of the points with Id _wpId.

Parameters
[in]_wpIdThe point Id.
[out]_wpThe waypoint requested.
Returns
True if the point was found or false otherwise.
std::vector<rndf::Waypoint>& ignition::rndf::Perimeter::Points ( )

Get a mutable reference to the vector of perimeter points.

Returns
A mutable reference to the vector of perimeter points.
const std::vector<rndf::Waypoint>& ignition::rndf::Perimeter::Points ( ) const

Get the vector of perimeter points.

Returns
The vector of perimeter points.
bool ignition::rndf::Perimeter::RemoveExit ( const Exit _exit)

Remove an existing exit.

Parameters
[in]_exitThe exit to be removed.
Returns
True when the exit was successfully deleted or false otherwise (e.g. if the exit was not found or invalid).
bool ignition::rndf::Perimeter::RemovePoint ( const int  _wpId)

Remove an existing perimeter point.

Parameters
[in]_wpIdThe waypoint Id to be removed.
Returns
True when the waypoint was successfully deleted from the list or false otherwise (e.g. if the Id of the waypoint was not found or invalid).
bool ignition::rndf::Perimeter::UpdatePoint ( const rndf::Waypoint _wp)

Update an existing point.

Parameters
[in]_wpThe updated waypoint.
Returns
True if the point was found and updated or false otherwise.
bool ignition::rndf::Perimeter::Valid ( ) const

Validation.

Returns
True if the parking spot is valid.

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