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... | |
Segment & | operator= (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... | |
Abstraction for representing road segments.
A road network is composed by one or more segments, each of which comprises one or more lanes.
ignition::rndf::Segment::Segment | ( | ) |
Default constructor.
|
explicit |
ignition::rndf::Segment::Segment | ( | const Segment & | _other | ) |
|
virtual |
Destructor.
bool ignition::rndf::Segment::AddLane | ( | const rndf::Lane & | _newLane | ) |
Add a new lane.
[in] | _newLane | A new lane to be added. |
int ignition::rndf::Segment::Id | ( | ) | const |
Id.
Get the unique identifier of the segment.
bool ignition::rndf::Segment::Lane | ( | const int | _laneId, |
rndf::Lane & | _lane | ||
) | const |
Get the details of one of the lane with Id _laneId.
[in] | _laneId | The lane Id. |
[out] | _lane | The lane requested. |
std::vector<rndf::Lane>& ignition::rndf::Segment::Lanes | ( | ) |
Get a mutable reference to the vector of lanes.
const std::vector<rndf::Lane>& ignition::rndf::Segment::Lanes | ( | ) | const |
Get the vector of lanes.
bool ignition::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.
[in,out] | _rndfFile | Input file stream. |
[in,out] | _lineNumber | Line number pointed by the stream position indicator. |
std::string ignition::rndf::Segment::Name | ( | ) | const |
Name.
Get the segment name. E.g.: "Wisconsin_Ave".
unsigned int ignition::rndf::Segment::NumLanes | ( | ) | const |
Lanes.
Get the number of lanes stored.
bool ignition::rndf::Segment::operator!= | ( | const Segment & | _other | ) | const |
Assignment operator.
[in] | _other | The new segment. |
bool ignition::rndf::Segment::operator== | ( | const Segment & | _other | ) | const |
Operators.
Equality operator, result = this == _other
[in] | _other | Segment to check for equality. |
bool ignition::rndf::Segment::RemoveLane | ( | const int | _laneId | ) |
Remove an existing lane.
[in] | _laneId | The lane Id to be removed. |
bool ignition::rndf::Segment::SetId | ( | const int | _id | ) |
Set the identifier of the segment.
[in] | _id | New unique Id. |
void ignition::rndf::Segment::SetName | ( | const std::string & | _name | ) | const |
Set the segment name.
E.g.: "Wisconsin_Ave".
[in] | _name | The new name. |
bool ignition::rndf::Segment::UpdateLane | ( | const rndf::Lane & | _lane | ) |
Update an existing lane.
[in] | _lane | The updated lane. |
bool ignition::rndf::Segment::Valid | ( | ) | const |
Validation.