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

Abstraction for representing road segments. More...

#include <Segment.hh>

Public Member Functions

 Segment ()
 Default constructor. More...
 
 Segment (const int _id)
 Constructor. More...
 
 Segment (const Segment &_other)
 Copy constructor. More...
 
virtual ~Segment ()
 Destructor. More...
 
bool AddLane (const rndf::Lane &_newLane)
 Add a new lane. More...
 
int Id () const
 Id. More...
 
bool Lane (const int _laneId, rndf::Lane &_lane) const
 Get the details of one of the lane with Id _laneId. More...
 
std::vector< rndf::Lane > & Lanes ()
 Get a mutable reference to the vector of lanes. More...
 
const std::vector< rndf::Lane > & Lanes () const
 Get the vector of lanes. More...
 
bool Load (std::ifstream &_rndfFile, int &_lineNumber)
 Parsing. More...
 
std::string Name () const
 Name. More...
 
unsigned int NumLanes () const
 Lanes. More...
 
bool operator!= (const Segment &_other) const
 Inequality. More...
 
Segmentoperator= (const Segment &_other)
 Assignment operator. More...
 
bool operator== (const Segment &_other) const
 Operators. More...
 
bool RemoveLane (const int _laneId)
 Remove an existing lane. More...
 
bool SetId (const int _id)
 Set the identifier of the segment. More...
 
void SetName (const std::string &_name) const
 Set the segment name. More...
 
bool UpdateLane (const rndf::Lane &_lane)
 Update an existing lane. More...
 
bool Valid () const
 Validation. More...
 

Detailed Description

Abstraction for representing road segments.

A road network is composed by one or more segments, each of which comprises one or more lanes.

Constructor & Destructor Documentation

manifold::rndf::Segment::Segment ( )

Default constructor.

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

Constructor.

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

Copy constructor.

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

Destructor.

Member Function Documentation

bool manifold::rndf::Segment::AddLane ( const rndf::Lane _newLane)

Add a new lane.

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

Id.

Get the unique identifier of the segment.

Returns
The segment Id.
bool manifold::rndf::Segment::Lane ( const int  _laneId,
rndf::Lane _lane 
) const

Get the details of one of the lane with Id _laneId.

Parameters
[in]_laneIdThe lane Id.
[out]_laneThe lane requested.
Returns
True if the lane was found or false otherwise.
std::vector<rndf::Lane>& manifold::rndf::Segment::Lanes ( )

Get a mutable reference to the vector of lanes.

Returns
A mutable reference to the vector of lanes.
const std::vector<rndf::Lane>& manifold::rndf::Segment::Lanes ( ) const

Get the vector of lanes.

Returns
The vector of lanes.
bool manifold::rndf::Segment::Load ( std::ifstream &  _rndfFile,
int &  _lineNumber 
)

Parsing.

Load a segment 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 segment block was found and parsed or false otherwise (e.g.: EoF or incorrect format found).
std::string manifold::rndf::Segment::Name ( ) const

Name.

Get the segment name. E.g.: "Wisconsin_Ave".

Returns
The segment name.
unsigned int manifold::rndf::Segment::NumLanes ( ) const

Lanes.

Get the number of lanes stored.

Returns
The number of lanes in this segment.
bool manifold::rndf::Segment::operator!= ( const Segment _other) const

Inequality.

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

Assignment operator.

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

Operators.

Equality operator, result = this == _other

Parameters
[in]_otherSegment to check for equality.
Returns
true if this == _other
bool manifold::rndf::Segment::RemoveLane ( const int  _laneId)

Remove an existing lane.

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

Set the identifier of the segment.

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 manifold::rndf::Segment::SetName ( const std::string &  _name) const

Set the segment name.

E.g.: "Wisconsin_Ave".

Parameters
[in]_nameThe new name.
bool manifold::rndf::Segment::UpdateLane ( const rndf::Lane _lane)

Update an existing lane.

Parameters
[in]_laneThe updated lane.
Returns
True if the lane was found and updated or false otherwise.
bool manifold::rndf::Segment::Valid ( ) const

Validation.

Returns
True if the segment is valid.

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