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

A unique id of the form x.y.z, where x and z are positive numbers and y is a non-negative number (perimeter Ids are always 0). More...

#include <UniqueId.hh>

Public Member Functions

 UniqueId ()
 Default constructor. More...
 
 UniqueId (const int _x, const int _y, const int _z)
 Constructor. More...
 
 UniqueId (const std::string &_id)
 Constructor. More...
 
 UniqueId (const UniqueId &_other)
 Copy constructor. More...
 
virtual ~UniqueId ()
 Destructor. More...
 
bool operator!= (const UniqueId &_other) const
 Inequality. More...
 
UniqueIdoperator= (const UniqueId &_other)
 Assignment operator. More...
 
bool operator== (const UniqueId &_other) const
 Equality operator, result = this == _other. More...
 
bool SetX (const int _x)
 Set the 'x' value. More...
 
bool SetY (const int _y)
 Set the 'y' value. More...
 
bool SetZ (const int _z)
 Set the 'z' value. More...
 
std::string String () const
 Convert to string. More...
 
bool Valid () const
 Whether the object is valid or not. More...
 
int X () const
 Get 'x' value. More...
 
int Y () const
 Get the 'y' value. More...
 
int Z () const
 Get the 'z' value. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const UniqueId &_id)
 Stream insertion operator. More...
 

Detailed Description

A unique id of the form x.y.z, where x and z are positive numbers and y is a non-negative number (perimeter Ids are always 0).

The maximum allowed value is 32768.

Constructor & Destructor Documentation

ignition::rndf::UniqueId::UniqueId ( )

Default constructor.

ignition::rndf::UniqueId::UniqueId ( const int  _x,
const int  _y,
const int  _z 
)
explicit

Constructor.

Parameters
[in]_xA positive number.
[in]_yA non-negative number.
[in]_zA positive number.
ignition::rndf::UniqueId::UniqueId ( const std::string &  _id)
explicit

Constructor.

Parameters
[in]_idWith format x.y.z
ignition::rndf::UniqueId::UniqueId ( const UniqueId _other)

Copy constructor.

Parameters
[in]_otherOther UniqueId.
virtual ignition::rndf::UniqueId::~UniqueId ( )
virtual

Destructor.

Member Function Documentation

bool ignition::rndf::UniqueId::operator!= ( const UniqueId _other) const

Inequality.

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

Assignment operator.

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

Equality operator, result = this == _other.

Parameters
[in]_otherUniqueId to check for equality.
Returns
true if this == _other
bool ignition::rndf::UniqueId::SetX ( const int  _x)

Set the 'x' value.

Parameters
[in]_xNew 'x' value.
Returns
True if the operation succeed or false otherwise (e.g.: if the 'x' is not valid).
See also
Valid.
bool ignition::rndf::UniqueId::SetY ( const int  _y)

Set the 'y' value.

Parameters
[in]_yNew 'y' value.
Returns
True if the operation succeed or false otherwise (e.g.: if the 'y' is not valid).
See also
Valid.
bool ignition::rndf::UniqueId::SetZ ( const int  _z)

Set the 'z' value.

Parameters
[in]_zNew 'z' value.
Returns
True if the operation succeed or false otherwise (e.g.: if the 'z' is not valid).
See also
Valid.
std::string ignition::rndf::UniqueId::String ( ) const

Convert to string.

Returns
A string representation of the unique Id.
bool ignition::rndf::UniqueId::Valid ( ) const

Whether the object is valid or not.

Returns
True if the unique Id is valid.
int ignition::rndf::UniqueId::X ( ) const

Get 'x' value.

Returns
The 'x' value.
int ignition::rndf::UniqueId::Y ( ) const

Get the 'y' value.

Returns
The 'y' value.
int ignition::rndf::UniqueId::Z ( ) const

Get the 'z' value.

Returns
The 'z' value.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  _out,
const UniqueId _id 
)
friend

Stream insertion operator.

Parameters
[out]_outThe output stream.
[in]_idUniqueId to write to the stream.

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