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

An abstraction to represent a Route Network Definition File (RNDF). More...

#include <RNDF.hh>

Public Member Functions

 RNDF ()
 Default constructor. More...
 
 RNDF (const std::string &_filepath)
 Constructor. More...
 
virtual ~RNDF ()
 Destructor. More...
 
bool AddSegment (const rndf::Segment &_newSegment)
 Add a new segment. More...
 
bool AddZone (const rndf::Zone &_newZone)
 Add a new zone. More...
 
std::string Date () const
 Date. More...
 
RNDFNodeInfo (const rndf::UniqueId &_id) const
 Utils. More...
 
bool Load (const std::string &_filePath)
 Parsing. More...
 
std::string Name () const
 Name. More...
 
unsigned int NumSegments () const
 Segments. More...
 
unsigned int NumZones () const
 Zones. More...
 
bool RemoveSegment (const int _segmentId)
 Remove an existing segment. More...
 
bool RemoveZone (const int _zoneId)
 Remove an existing zone. More...
 
bool Segment (const int _segmentId, rndf::Segment &_segment) const
 Get the details of one of the segments with Id _segmentId. More...
 
std::vector< rndf::Segment > & Segments ()
 Get a mutable reference to the vector of segments. More...
 
const std::vector< rndf::Segment > & Segments () const
 Get the vector of segments. More...
 
void SetDate (const std::string &_newDate) const
 Set the creation date. More...
 
void SetName (const std::string &_name)
 Set the segment name. More...
 
void SetVersion (const std::string &_version) const
 Set the format version. More...
 
bool UpdateSegment (const rndf::Segment &_segment)
 Update an existing segment. More...
 
bool UpdateZone (const rndf::Zone &_zone)
 Update an existing zone. More...
 
bool Valid () const
 Validation. More...
 
std::string Version () const
 Version. More...
 
bool Zone (const int _zoneId, rndf::Zone &_zone) const
 Get the details of one of the zones with Id _zoneId. More...
 
std::vector< rndf::Zone > & Zones ()
 Get a mutable reference to the vector of zones. More...
 
const std::vector< rndf::Zone > & Zones () const
 Get the vector of zones. More...
 

Detailed Description

An abstraction to represent a Route Network Definition File (RNDF).

Please, refer to the specification for more details. http://www.grandchallenge.org/grandchallenge/docs/RNDF_MDF_Formats_031407.pdf

Constructor & Destructor Documentation

ignition::rndf::RNDF::RNDF ( )

Default constructor.

ignition::rndf::RNDF::RNDF ( const std::string &  _filepath)
explicit

Constructor.

Parameters
[in]_filepathPath to an existing RNDF file.
virtual ignition::rndf::RNDF::~RNDF ( )
virtual

Destructor.

Member Function Documentation

bool ignition::rndf::RNDF::AddSegment ( const rndf::Segment _newSegment)

Add a new segment.

Parameters
[in]_newSegmentA new segment to be added.
Returns
True when the segment was successfully added to the list or false otherwise (e.g. if the Id of the segment was already existing or invalid).
bool ignition::rndf::RNDF::AddZone ( const rndf::Zone _newZone)

Add a new zone.

Parameters
[in]_newZoneA new zone to be added.
Returns
True when the zone was successfully added to the list or false otherwise (e.g. if the Id of the zone was already existing or invalid).
std::string ignition::rndf::RNDF::Date ( ) const

Date.

Get the creation date.

Returns
The creation date.
RNDFNode* ignition::rndf::RNDF::Info ( const rndf::UniqueId _id) const

Utils.

Get a pointer to the associated RNDF node given a unique Id. The RNDFNode object contains the metada associated to the id.

Parameters
[in]_idThe Unique Id to check.
Returns
A pointer to the RNDFnode.
bool ignition::rndf::RNDF::Load ( const std::string &  _filePath)

Parsing.

Load a RNDF from an input stream coming from a text file. The expected format is the one specified on the RNDF spec.

Parameters
[in,out]_filePathPath to RNDF file.
Returns
True if the entire RNDF was correctly parsed or false otherwise (e.g.: EoF or incorrect format found).
std::string ignition::rndf::RNDF::Name ( ) const

Name.

Get the segment name.

Returns
The segment name.
unsigned int ignition::rndf::RNDF::NumSegments ( ) const

Segments.

Get the number of segments stored.

Returns
The number of segments in this RNDF.
unsigned int ignition::rndf::RNDF::NumZones ( ) const

Zones.

Get the number of zones stored.

Returns
The number of zones in this RNDF.
bool ignition::rndf::RNDF::RemoveSegment ( const int  _segmentId)

Remove an existing segment.

Parameters
[in]_segmentIdThe segment Id to be removed.
Returns
True when the segment was successfully deleted from the list or false otherwise (e.g. if the Id of the segment was not found or invalid).
bool ignition::rndf::RNDF::RemoveZone ( const int  _zoneId)

Remove an existing zone.

Parameters
[in]_zoneIdThe zone Id to be removed.
Returns
True when the zone was successfully deleted from the list or false otherwise (e.g. if the Id of the zone was not found or invalid).
bool ignition::rndf::RNDF::Segment ( const int  _segmentId,
rndf::Segment _segment 
) const

Get the details of one of the segments with Id _segmentId.

Parameters
[in]_segmentIdThe segment Id.
[out]_segmentThe segment requested.
Returns
True if the segment was found or false otherwise.
std::vector<rndf::Segment>& ignition::rndf::RNDF::Segments ( )

Get a mutable reference to the vector of segments.

Returns
A mutable reference to the vector of segments.
const std::vector<rndf::Segment>& ignition::rndf::RNDF::Segments ( ) const

Get the vector of segments.

Returns
The vector of segments.
void ignition::rndf::RNDF::SetDate ( const std::string &  _newDate) const

Set the creation date.

Parameters
[in]_newDateThe new creation date.
void ignition::rndf::RNDF::SetName ( const std::string &  _name)

Set the segment name.

Parameters
[in]_nameThe new name.
void ignition::rndf::RNDF::SetVersion ( const std::string &  _version) const

Set the format version.

Parameters
[in]_versionThe new version.
bool ignition::rndf::RNDF::UpdateSegment ( const rndf::Segment _segment)

Update an existing segment.

Parameters
[in]_segmentThe updated segment.
Returns
True if the segment was found and updated or false otherwise.
bool ignition::rndf::RNDF::UpdateZone ( const rndf::Zone _zone)

Update an existing zone.

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

Validation.

Whether the current RNDF object is valid or not.

Returns
True if the RNDF is valid.
std::string ignition::rndf::RNDF::Version ( ) const

Version.

Get the format version. E.g.: "2.3.6".

Returns
The format version.
bool ignition::rndf::RNDF::Zone ( const int  _zoneId,
rndf::Zone _zone 
) const

Get the details of one of the zones with Id _zoneId.

Parameters
[in]_zoneIdThe zone Id.
[out]_zoneThe zone requested.
Returns
True if the zone was found or false otherwise.
std::vector<rndf::Zone>& ignition::rndf::RNDF::Zones ( )

Get a mutable reference to the vector of zones.

Returns
A mutable reference to the vector of zones.
const std::vector<rndf::Zone>& ignition::rndf::RNDF::Zones ( ) const

Get the vector of zones.

Returns
The vector of zones.

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