All Classes Namespaces Files Functions Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
manifold::rndf::Zone Class Reference

An abstraction for representing areas within free vehicle movement is permitted. More...

#include <Zone.hh>

Public Member Functions

 Zone ()
 Default constructor. More...
 
 Zone (const int _id)
 Constructor. More...
 
 Zone (const Zone &_other)
 Copy constructor. More...
 
virtual ~Zone ()
 Destructor. More...
 
bool AddSpot (const ParkingSpot &_newSpot)
 Add a new parking spot. More...
 
int Id () const
 Id. More...
 
bool Load (std::ifstream &_rndfFile, int &_lineNumber)
 Parsing. More...
 
std::string Name () const
 Name. More...
 
unsigned int NumSpots () const
 Parking spots. More...
 
bool operator!= (const Zone &_other) const
 Inequality. More...
 
Zoneoperator= (const Zone &_other)
 Assignment operator. More...
 
bool operator== (const Zone &_other) const
 Operators. More...
 
rndf::PerimeterPerimeter ()
 Perimeter. More...
 
const rndf::PerimeterPerimeter () const
 Get the perimeter. More...
 
bool RemoveSpot (const int _psId)
 Remove an existing parking spot. More...
 
bool SetId (const int _id)
 Set the identifier of the zone. More...
 
void SetName (const std::string &_name) const
 Set the zone name. More...
 
bool Spot (const int _psId, ParkingSpot &_ps) const
 Get the details of one of the parking spots with Id _psId. More...
 
std::vector< ParkingSpot > & Spots ()
 Get a mutable reference to the vector of parking spots. More...
 
const std::vector< ParkingSpot > & Spots () const
 Get the vector of parking spots. More...
 
bool UpdateSpot (const ParkingSpot &_ps)
 Update an existing parking spot. More...
 
bool Valid () const
 Validation. More...
 

Detailed Description

An abstraction for representing areas within free vehicle movement is permitted.

The zone is determined by a polygonal boundary defined by perimeter points. Some perimeter points are identified as entry and exit points into the zone area. A zone may also include one or more parking spots, each specified by a pair of waypoints.

Constructor & Destructor Documentation

manifold::rndf::Zone::Zone ( )
explicit

Default constructor.

See Also
Valid.
manifold::rndf::Zone::Zone ( const int  _id)
explicit

Constructor.

Parameters
[in]_idZone Id (a positive number).
See Also
Valid.
manifold::rndf::Zone::Zone ( const Zone _other)

Copy constructor.

Parameters
[in]_otherOther zone to copy from.
See Also
Valid.
virtual manifold::rndf::Zone::~Zone ( )
virtual

Destructor.

Member Function Documentation

bool manifold::rndf::Zone::AddSpot ( const ParkingSpot _newSpot)

Add a new parking spot.

Parameters
[in]_newSpotA new spot to be added.
Returns
True when the parking spot was successfully added to the list or false otherwise (e.g. if the Id of the spot was already existing or invalid).
int manifold::rndf::Zone::Id ( ) const

Id.

Get the unique identifier of the zone.

Returns
The zone Id.
bool manifold::rndf::Zone::Load ( std::ifstream &  _rndfFile,
int &  _lineNumber 
)

Parsing.

Load a zone 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]_lineNumberLine number pointed by the stream position indicator.
Returns
True if a zone block was found and parsed or false otherwise (e.g.: EoF or incorrect format found).
std::string manifold::rndf::Zone::Name ( ) const

Name.

Get the zone name. E.g.: "North_parking_lot".

Returns
The zone name.
unsigned int manifold::rndf::Zone::NumSpots ( ) const

Parking spots.

Get the number of parking spots stored.

Returns
The number of parking spots in the current zone.
bool manifold::rndf::Zone::operator!= ( const Zone _other) const

Inequality.

Parameters
[in]_otherZone to check for inequality.
Returns
true if this != _other
Zone& manifold::rndf::Zone::operator= ( const Zone _other)

Assignment operator.

Parameters
[in]_otherThe new zone.
Returns
A reference to this instance.
bool manifold::rndf::Zone::operator== ( const Zone _other) const

Operators.

Equality operator, result = this == _other

Parameters
[in]_otherZone to check for equality.
Returns
true if this == _other
rndf::Perimeter& manifold::rndf::Zone::Perimeter ( )

Perimeter.

Get a mutable reference to the perimeter.

Returns
A mutable reference to the perimeter.
const rndf::Perimeter& manifold::rndf::Zone::Perimeter ( ) const

Get the perimeter.

Returns
The perimeter.
bool manifold::rndf::Zone::RemoveSpot ( const int  _psId)

Remove an existing parking spot.

Parameters
[in]_psIdThe parking spot Id to be removed.
Returns
True when the sopt was successfully deleted from the list or false otherwise (e.g. if the Id of the waypoint was not found or invalid).
bool manifold::rndf::Zone::SetId ( const int  _id)

Set the identifier of the zone.

Parameters
[in]_idNew unique Id.
Returns
True if the operation succeed or false otherwise (e.g.: if the id is not valid).
void manifold::rndf::Zone::SetName ( const std::string &  _name) const

Set the zone name.

E.g.: "North_parking_lot".

Parameters
[in]_nameThe new name.
bool manifold::rndf::Zone::Spot ( const int  _psId,
ParkingSpot _ps 
) const

Get the details of one of the parking spots with Id _psId.

Parameters
[in]_psIdThe parking spot Id.
[out]_psThe parking spot requested.
Returns
True if the parking spot was found or false otherwise.
std::vector<ParkingSpot>& manifold::rndf::Zone::Spots ( )

Get a mutable reference to the vector of parking spots.

Returns
A mutable reference to the vector of parking spots.
const std::vector<ParkingSpot>& manifold::rndf::Zone::Spots ( ) const

Get the vector of parking spots.

Returns
The vector of parking spots.
bool manifold::rndf::Zone::UpdateSpot ( const ParkingSpot _ps)

Update an existing parking spot.

Parameters
[in]_psThe updated parking spot.
Returns
True if the spot was found and updated or false otherwise.
bool manifold::rndf::Zone::Valid ( ) const

Validation.

Whether the current object is valid or not.

Returns
True if the zone is valid.

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