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

An abstraction for representing a parking spot within a zone. More...

#include <ParkingSpot.hh>

Public Member Functions

 ParkingSpot ()
 Default constructor. More...
 
 ParkingSpot (const int _spotId)
 Constructor. More...
 
 ParkingSpot (const ParkingSpot &_other)
 Copy constructor. More...
 
virtual ~ParkingSpot ()
 Destructor. More...
 
bool AddWaypoint (const rndf::Waypoint &_newWaypoint)
 Add a new waypoint. More...
 
rndf::CheckpointCheckpoint ()
 Checkpoint. More...
 
const rndf::CheckpointCheckpoint () const
 Get the checkpoint. More...
 
int Id () const
 Id. More...
 
bool Load (std::ifstream &_rndfFile, const int _zoneId, int &_lineNumber)
 Parsing. More...
 
unsigned int NumWaypoints () const
 Waypoints. More...
 
bool operator!= (const ParkingSpot &_other) const
 Inequality. More...
 
ParkingSpotoperator= (const ParkingSpot &_other)
 Assignment operator. More...
 
bool operator== (const ParkingSpot &_other) const
 Operators. More...
 
bool RemoveWaypoint (const int _wpId)
 Remove an existing waypoint. More...
 
bool SetId (const int _id)
 Set the identifier of the parking spot. More...
 
bool SetWidth (const double _newWidth)
 Set the parking spot width. 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

An abstraction for representing a parking spot within a zone.

Constructor & Destructor Documentation

ignition::rndf::ParkingSpot::ParkingSpot ( )

Default constructor.

ignition::rndf::ParkingSpot::ParkingSpot ( const int  _spotId)
explicit

Constructor.

Parameters
[in]_spotIdParking spot Id (a positive number).
ignition::rndf::ParkingSpot::ParkingSpot ( const ParkingSpot _other)

Copy constructor.

Parameters
[in]_otherOther parking spot.
virtual ignition::rndf::ParkingSpot::~ParkingSpot ( )
virtual

Destructor.

Member Function Documentation

bool ignition::rndf::ParkingSpot::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).
rndf::Checkpoint& ignition::rndf::ParkingSpot::Checkpoint ( )

Checkpoint.

Get a mutable reference to the checkpoint.

Returns
A mutable reference to the checkpoint.
const rndf::Checkpoint& ignition::rndf::ParkingSpot::Checkpoint ( ) const

Get the checkpoint.

Returns
The checkpoint.
int ignition::rndf::ParkingSpot::Id ( ) const

Id.

Get the Id.

Returns
The parking spot Id.
bool ignition::rndf::ParkingSpot::Load ( std::ifstream &  _rndfFile,
const int  _zoneId,
int &  _lineNumber 
)

Parsing.

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

Waypoints.

Get the number of waypoints stored.

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

Inequality.

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

Assignment operator.

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

Operators.

Equality operator, result = this == _other

Parameters
[in]_otherParking spot to check for equality.
Returns
true if this == _other
bool ignition::rndf::ParkingSpot::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).
bool ignition::rndf::ParkingSpot::SetId ( const int  _id)

Set the identifier of the parking spot.

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.
bool ignition::rndf::ParkingSpot::SetWidth ( const double  _newWidth)

Set the parking spot width.

Parameters
[in]_newWidthThe new width in meters.
Returns
True if the new width was set of false otherwise (invalid value).
bool ignition::rndf::ParkingSpot::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::ParkingSpot::Valid ( ) const

Validation.

Returns
True if the parking spot is valid.
bool ignition::rndf::ParkingSpot::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::ParkingSpot::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::ParkingSpot::Waypoints ( ) const

Get the vector of waypoints;.

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

Width.

Get the parking spot width in meters.

Returns
Return the parking spot width in meters.

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