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

A class that represents a road lane composed by a set of waypoints. More...

#include <Lane.hh>

Public Member Functions

 Lane ()
 Default constructor. More...
 
 Lane (const int _id)
 Constructor. More...
 
 Lane (const Lane &_other)
 Copy constructor. More...
 
virtual ~Lane ()
 Destructor. More...
 
bool AddCheckpoint (const rndf::Checkpoint &_newCheckpoint)
 Add a new checkpoint. More...
 
bool AddExit (const Exit &_newExit)
 Add a new exit. More...
 
bool AddStop (const int _waypointId)
 Add a new stop. More...
 
bool AddWaypoint (const rndf::Waypoint &_newWaypoint)
 Add a new waypoint. More...
 
bool Checkpoint (const int _cpId, rndf::Checkpoint &_cp) const
 Get the details of one of the checkpoints with Id _cpId. More...
 
std::vector< rndf::Checkpoint > & Checkpoints ()
 Get a mutable reference to the vector of checkpoints;. More...
 
const std::vector< rndf::Checkpoint > & Checkpoints () const
 Get the vector of checkpoints;. 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...
 
int Id () const
 Id. More...
 
Marking LeftBoundary () const
 Boundaries. More...
 
bool Load (std::ifstream &_rndfFile, const int _segmentId, int &_lineNumber)
 Parsing. More...
 
unsigned int NumCheckpoints () const
 Checkpoints. More...
 
unsigned int NumExits () const
 Exits. More...
 
unsigned int NumStops () const
 Stops. More...
 
unsigned int NumWaypoints () const
 Waypoints. More...
 
bool operator!= (const Lane &_other) const
 Inequality. More...
 
Laneoperator= (const Lane &_other)
 Assignment operator. More...
 
bool operator== (const Lane &_other) const
 Operators. More...
 
bool RemoveCheckpoint (const int _cpId)
 Remove an existing checkpoint. More...
 
bool RemoveExit (const Exit &_exit)
 Remove an existing exit. More...
 
bool RemoveStop (const int _waypointId)
 Remove an existing stop. More...
 
bool RemoveWaypoint (const int _wpId)
 Remove an existing waypoint. More...
 
Marking RightBoundary () const
 Get the right boundary type. More...
 
bool SetId (const int _id)
 Set the identifier of the lane. More...
 
void SetLeftBoundary (const Marking &_boundary)
 Set the new left boundary type. More...
 
void SetRightBoundary (const Marking &_boundary)
 Set the new right boundary type. More...
 
bool SetWidth (const double _newWidth)
 Set the lane width. More...
 
std::vector< int > & Stops ()
 Get a mutable reference to the vector of stops. More...
 
const std::vector< int > & Stops () const
 Get the vector of stops. More...
 
bool UpdateCheckpoint (const rndf::Checkpoint &_cp)
 Update an existing checkpoint. More...
 
bool UpdateWaypoint (const rndf::Waypoint &_wp)
 Update an existing waypoint. More...
 
bool Valid () const
 Validation. More...
 
bool Waypoint (const int _wpId, rndf::Waypoint &_wp) const
 Get the details of one of the waypoints with Id _wpId. More...
 
std::vector< rndf::Waypoint > & Waypoints ()
 Get a mutable reference to the vector of waypoints. More...
 
const std::vector< rndf::Waypoint > & Waypoints () const
 Get the vector of waypoints. More...
 
double Width () const
 Width. More...
 

Detailed Description

A class that represents a road lane composed by a set of waypoints.

Constructor & Destructor Documentation

ignition::rndf::Lane::Lane ( )

Default constructor.

See also
Valid.
ignition::rndf::Lane::Lane ( const int  _id)
explicit

Constructor.

Parameters
[in]_idLane Id (a positive number).
See also
Valid.
ignition::rndf::Lane::Lane ( const Lane _other)
explicit

Copy constructor.

Parameters
[in]_otherOther lane.
See also
Valid.
virtual ignition::rndf::Lane::~Lane ( )
virtual

Destructor.

Member Function Documentation

bool ignition::rndf::Lane::AddCheckpoint ( const rndf::Checkpoint _newCheckpoint)

Add a new checkpoint.

Parameters
[in]_newCheckpointA new checkpoint to be added.
Returns
True when the checkpoint was successfully added to the list or false otherwise (e.g. if the Id of the checkpoint was already existing or invalid).
bool ignition::rndf::Lane::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::Lane::AddStop ( const int  _waypointId)

Add a new stop.

Parameters
[in]_waypointIdThe Id of a new waypoint considered a stop.
Returns
True when the stop was successfully added to the list or false otherwise (e.g. if the Id of the waypoint was already existing or invalid).
bool ignition::rndf::Lane::AddWaypoint ( const rndf::Waypoint _newWaypoint)

Add a new waypoint.

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).
bool ignition::rndf::Lane::Checkpoint ( const int  _cpId,
rndf::Checkpoint _cp 
) const

Get the details of one of the checkpoints with Id _cpId.

Parameters
[in]_cpIdThe checkpoint Id.
[out]_cpThe checkpoint requested.
Returns
True if the checkpoint was found or false otherwise.
std::vector<rndf::Checkpoint>& ignition::rndf::Lane::Checkpoints ( )

Get a mutable reference to the vector of checkpoints;.

Returns
A mutable reference to the vector of checkpoints.
const std::vector<rndf::Checkpoint>& ignition::rndf::Lane::Checkpoints ( ) const

Get the vector of checkpoints;.

Returns
The vector of checkpoints.
std::vector<Exit>& ignition::rndf::Lane::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::Lane::Exits ( ) const

Get the vector of stops.

Returns
The vector of stops.
int ignition::rndf::Lane::Id ( ) const

Id.

Get the unique identifier of the lane.

Returns
The lane Id.
Marking ignition::rndf::Lane::LeftBoundary ( ) const

Boundaries.

Get the left boundary type.

Returns
The left boundary type.
bool ignition::rndf::Lane::Load ( std::ifstream &  _rndfFile,
const int  _segmentId,
int &  _lineNumber 
)

Parsing.

Load a lane 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,out]_segmentIdExpected segment Id.
[in,out]_lineNumberLine number pointed by the stream position indicator.
Returns
True if a lane block was found and parsed or false otherwise (e.g.: EoF or incorrect format found).
unsigned int ignition::rndf::Lane::NumCheckpoints ( ) const

Checkpoints.

Get the number of checkpoints stored.

Returns
The number of checkpoints in the current lane.
unsigned int ignition::rndf::Lane::NumExits ( ) const

Exits.

Get the number of exits stored.

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

Stops.

Get the number of stops stored.

Returns
The number of stops in the current lane.
unsigned int ignition::rndf::Lane::NumWaypoints ( ) const

Waypoints.

Get the number of waypoints stored.

Returns
The number of waypoints in the current lane.
bool ignition::rndf::Lane::operator!= ( const Lane _other) const

Inequality.

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

Assignment operator.

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

Operators.

Equality operator, result = this == _other

Parameters
[in]_otherLane to check for equality.
Returns
true if this == _other
bool ignition::rndf::Lane::RemoveCheckpoint ( const int  _cpId)

Remove an existing checkpoint.

Parameters
[in]_cpIdThe checkpoint Id to be removed.
Returns
True when the checkpoint was successfully deleted or false otherwise (e.g. if the Id of the checkpoint was not found or invalid).
bool ignition::rndf::Lane::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::Lane::RemoveStop ( const int  _waypointId)

Remove an existing stop.

Parameters
[in]_waypointIdThe waypoint Id (of a stop sign) to be removed.
Returns
True when the waypoint was successfully deleted or false otherwise (e.g. if the Id of the waypoint was not found or invalid).
bool ignition::rndf::Lane::RemoveWaypoint ( const int  _wpId)

Remove an existing waypoint.

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).
Marking ignition::rndf::Lane::RightBoundary ( ) const

Get the right boundary type.

Returns
The right boundary type.
bool ignition::rndf::Lane::SetId ( const int  _id)

Set the identifier of the lane.

Parameters
[in]_idNew unique Id.
Returns
True if the operation succeed or false otherwise (e.g.: if the id is not valid).
See also
Valid.
void ignition::rndf::Lane::SetLeftBoundary ( const Marking _boundary)

Set the new left boundary type.

Parameters
[in]_boundaryThe new left boundary type.
void ignition::rndf::Lane::SetRightBoundary ( const Marking _boundary)

Set the new right boundary type.

Parameters
[in]_boundaryThe new right boundary type.
bool ignition::rndf::Lane::SetWidth ( const double  _newWidth)

Set the lane width.

Parameters
[in]_newWidthThe new width in meters.
std::vector<int>& ignition::rndf::Lane::Stops ( )

Get a mutable reference to the vector of stops.

The elements are waypoint Ids.

Returns
A mutable reference to the vector of stops.
const std::vector<int>& ignition::rndf::Lane::Stops ( ) const

Get the vector of stops.

The elements are waypoint Ids.

Returns
The vector of stops.
bool ignition::rndf::Lane::UpdateCheckpoint ( const rndf::Checkpoint _cp)

Update an existing checkpoint.

Parameters
[in]_cpThe updated checkpoint.
Returns
True if the checkpoint was found and updated or false otherwise.
bool ignition::rndf::Lane::UpdateWaypoint ( const rndf::Waypoint _wp)

Update an existing waypoint.

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

Validation.

Returns
True if the lane is valid.
bool ignition::rndf::Lane::Waypoint ( const int  _wpId,
rndf::Waypoint _wp 
) const

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

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

Get a mutable reference to the vector of waypoints.

Returns
A mutable reference to the vector of waypoints.
const std::vector<rndf::Waypoint>& ignition::rndf::Lane::Waypoints ( ) const

Get the vector of waypoints.

Returns
The vector of waypoints.
double ignition::rndf::Lane::Width ( ) const

Width.

Get the lane width in meters.

Returns
Return the lane width in meters.

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