DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
Diades::Utils::Identifier Class Reference

An Identifier is a reference to a string (IdentifierData) that only contains alpha-numeric characters and underscores. More...

#include <Identifier.hh>

Public Types

typedef Utils::Exception< IdentifierException
 
typedef string::const_iterator ConstIterator
 
typedef string::const_reverse_iterator ConstReverseIterator
 

Public Member Functions

 Identifier ()
 
 Identifier (IdentifierData *data)
 
 Identifier (const char *cString)
 
 Identifier (const string &str)
 
 Identifier (const Identifier &identifier)
 
bool valid () const
 
Identifieroperator= (const Identifier &identifier)
 
unsigned id () const
 
ConstIterator begin () const
 
double rank () const
 
ConstIterator end ()
 
ConstReverseIterator rbegin ()
 
ConstReverseIterator rend ()
 
size_t size () const
 
size_t length () const
 
const char & operator[] (size_t pos) const
 
Identifieroperator+= (const Identifier &str)
 
Identifieroperator+= (const string &str)
 
Identifieroperator+= (const char *s)
 
Identifieroperator+= (char c)
 
const string & str () const
 
const char * c_str () const
 
bool operator== (const Identifier &identifier) const
 
bool operator!= (const Identifier &identifier) const
 
bool operator< (const Identifier &identifier) const
 

Static Public Member Functions

static string typeName ()
 

Private Attributes

IdentifierData_data
 

Friends

class IdentifierFactory
 
istream & operator>> (istream &is, Identifier &identifier)
 

Detailed Description

An Identifier is a reference to a string (IdentifierData) that only contains alpha-numeric characters and underscores.

Definition at line 133 of file Identifier.hh.

Member Typedef Documentation

◆ ConstIterator

typedef string::const_iterator Diades::Utils::Identifier::ConstIterator

Definition at line 145 of file Identifier.hh.

◆ ConstReverseIterator

typedef string::const_reverse_iterator Diades::Utils::Identifier::ConstReverseIterator

Definition at line 146 of file Identifier.hh.

◆ Exception

Definition at line 144 of file Identifier.hh.

Constructor & Destructor Documentation

◆ Identifier() [1/5]

Diades::Utils::Identifier::Identifier ( )
inline

Default constructor: create an invalid Identifier

Definition at line 153 of file Identifier.hh.

◆ Identifier() [2/5]

Diades::Utils::Identifier::Identifier ( IdentifierData data)
inline

Param Constructor

Parameters
datathe underlying string (IdentifierData)

Associate the Identifier to its data

Definition at line 164 of file Identifier.hh.

◆ Identifier() [3/5]

Diades::Utils::Identifier::Identifier ( const char *  cString)

Param Constructor

Parameters
cStringa string to associate

Create an Identifier refering 'cString'.

Note
Note that IdentifierData associated to cString might be already created In this case, it won't be duplicated

◆ Identifier() [4/5]

Diades::Utils::Identifier::Identifier ( const string &  str)

Param Constructor

Parameters
stra string to associate

Create an Identifier refering 'cString'.

Note
Note that IdentifierData associated to cString might be already created In this case, it won't be duplicated

◆ Identifier() [5/5]

Diades::Utils::Identifier::Identifier ( const Identifier identifier)
inline

Copy constructor (reference copy, no string duplications)

Parameters
identifierthe Identifier to copy

Definition at line 202 of file Identifier.hh.

Member Function Documentation

◆ begin()

ConstIterator Diades::Utils::Identifier::begin ( ) const
inline
Returns
a constant iterator on the first character of the Identifier
Precondition
the Identifier must be valid

Definition at line 256 of file Identifier.hh.

References always_require.

◆ c_str()

const char* Diades::Utils::Identifier::c_str ( ) const
inline
Returns
the underlying c-string of the Identifier
Precondition
the Identifier must be valid

Definition at line 437 of file Identifier.hh.

References always_require.

◆ end()

ConstIterator Diades::Utils::Identifier::end ( )
inline
Returns
a constant iterator on the position after the last character of the Identifier
Precondition
the Identifier must be valid

Definition at line 283 of file Identifier.hh.

References always_require.

◆ id()

unsigned Diades::Utils::Identifier::id ( ) const
inline
Returns
the internal id of the Identifier
Precondition
the Identifier must be valid

Definition at line 242 of file Identifier.hh.

References always_require, and Diades::Utils::IdentifierData::id().

◆ length()

size_t Diades::Utils::Identifier::length ( ) const
inline
Returns
the length of the Identifier (the length of the underlying string)
Precondition
the Identifier must be valid

Definition at line 338 of file Identifier.hh.

◆ operator!=()

bool Diades::Utils::Identifier::operator!= ( const Identifier identifier) const
inline

Difference operator (reference equality)

Parameters
identifierthe Identifier to test
Returns
true if the current Identifier is not the same as 'identifier'

Definition at line 463 of file Identifier.hh.

◆ operator+=() [1/4]

Identifier& Diades::Utils::Identifier::operator+= ( const Identifier str)
Parameters
idthe Identifier to append to the current one
Returns
An Identifier that results from the appending of the current one and 'id'

◆ operator+=() [2/4]

Identifier& Diades::Utils::Identifier::operator+= ( const string &  str)
Parameters
strthe string to append to the current Identifier
Returns
an Identifier that results from the appending of the current one and 'str'

◆ operator+=() [3/4]

Identifier& Diades::Utils::Identifier::operator+= ( const char *  s)
Parameters
sthe c-string to append to the current Identifier
Returns
an Identifier that results from the appending of the current one and 's'

◆ operator+=() [4/4]

Identifier& Diades::Utils::Identifier::operator+= ( char  c)
Parameters
cthe character to append to the current Identifier
Returns
an Identifier that results from the appending of the current one and 'c'

◆ operator<()

bool Diades::Utils::Identifier::operator< ( const Identifier identifier) const

Comparison operator (lexicographic order)

Parameters
identifierthe Identifier to test
Returns
true if the current Identifier is smaller than 'identifier'

◆ operator=()

Identifier& Diades::Utils::Identifier::operator= ( const Identifier identifier)
inline

Assignation operator (reference assignation, not a copy)

Parameters
identifierthe identifier to assign
Returns
the current assigned Identifier

Definition at line 224 of file Identifier.hh.

References _data.

◆ operator==()

bool Diades::Utils::Identifier::operator== ( const Identifier identifier) const
inline

Equality operator (reference equality)

Parameters
identifierthe Identifier to test
Returns
true if the current Identifier is the same as 'identifier'

Definition at line 451 of file Identifier.hh.

References _data.

◆ operator[]()

const char& Diades::Utils::Identifier::operator[] ( size_t  pos) const
inline
Parameters
posa position index
Returns
the character at the given position index
Precondition
the Identifier must be valid

Definition at line 351 of file Identifier.hh.

References always_require.

◆ rank()

double Diades::Utils::Identifier::rank ( ) const
inline
Returns
the internal ranking of the Identifier

Definition at line 269 of file Identifier.hh.

References always_require, and Diades::Utils::IdentifierData::rank().

Referenced by std::hash< Diades::Utils::Identifier >::operator()().

◆ rbegin()

ConstReverseIterator Diades::Utils::Identifier::rbegin ( )
inline
Returns
a reverse constant iterator on the last character of the Identifier
Precondition
the Identifier must be valid

Definition at line 297 of file Identifier.hh.

References always_require.

◆ rend()

ConstReverseIterator Diades::Utils::Identifier::rend ( )
inline
Returns
a reverse constant iterator on the position before the first character of the Identifier
Precondition
the Identifier must be valid

Definition at line 310 of file Identifier.hh.

References always_require.

◆ size()

size_t Diades::Utils::Identifier::size ( ) const
inline
Returns
the size of the Identifier (the size of the underlying string)
Precondition
the Identifier must be valid

Definition at line 324 of file Identifier.hh.

References always_require.

◆ str()

const string& Diades::Utils::Identifier::str ( ) const
inline
Returns
the underlying string of the Identifier
Precondition
the Identifier must be valid

Definition at line 421 of file Identifier.hh.

References always_require.

Referenced by getOutputProjection(), getSynchronisedInteraction(), main(), and Diades::Utils::operator<<().

◆ typeName()

static string Diades::Utils::Identifier::typeName ( )
inlinestatic

Definition at line 143 of file Identifier.hh.

◆ valid()

bool Diades::Utils::Identifier::valid ( ) const
inline
Returns
true if the Identifier is valid (it is associated to an IdentifierData)

Definition at line 211 of file Identifier.hh.

Referenced by std::hash< Diades::Utils::Identifier >::operator()(), and Diades::Utils::operator<<().

Friends And Related Function Documentation

◆ IdentifierFactory

friend class IdentifierFactory
friend

Definition at line 489 of file Identifier.hh.

◆ operator>>

istream& operator>> ( istream &  is,
Identifier identifier 
)
friend

Input Stream operator

Parameters
isinput stream
identifierthe resulting Identifier
Returns
the input stream after reading the identifier. 'identifier' contains the identifier contained in the input stream

Member Data Documentation

◆ _data

IdentifierData* Diades::Utils::Identifier::_data
private

_data the underlying string (IdentifierData)

Definition at line 139 of file Identifier.hh.

Referenced by operator=(), and operator==().


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