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

A IdentifierFactory is a factory in charge of creating IdentifierData. More...

#include <Identifier.hh>

Public Types

typedef Utils::Exception< IdentifierFactoryException
 

Public Member Functions

 ~IdentifierFactory ()
 
Identifier getIdentifier (unsigned id)
 
Identifier getIdentifier (const std::string &str)
 

Static Public Member Functions

static void destroy ()
 
static string typeName ()
 
static IdentifierFactoryfactory ()
 

Protected Member Functions

 IdentifierFactory ()
 

Private Attributes

vector< Identifier_identifiers
 
map< double, Identifier_rankings
 
unordered_map< string, unsigned > _dictionary
 

Static Private Attributes

static IdentifierFactory_instance
 

Detailed Description

A IdentifierFactory is a factory in charge of creating IdentifierData.

A IdentifierFactory implements the singleton pattern, that is there is only one instance of the IdentifierFactory througout the process. It gathers the pool of allocated IdentifierData througout the process. IdentifierFactory guarantees that each IdentifierData is unique (no two IdentifierData with the same string)

Definition at line 522 of file Identifier.hh.

Member Typedef Documentation

◆ Exception

Definition at line 555 of file Identifier.hh.

Constructor & Destructor Documentation

◆ IdentifierFactory()

Diades::Utils::IdentifierFactory::IdentifierFactory ( )
inlineprotected

Default constructor

Definition at line 551 of file Identifier.hh.

◆ ~IdentifierFactory()

Diades::Utils::IdentifierFactory::~IdentifierFactory ( )

Destructor

Member Function Documentation

◆ destroy()

static void Diades::Utils::IdentifierFactory::destroy ( )
static

Destroy the Identifier factory.

Note
Should be used only at the end of the process for proper memory management. Be aware that the use of the function destroys all the allocated Identifiers.

◆ factory()

static IdentifierFactory* Diades::Utils::IdentifierFactory::factory ( )
static
Returns
the unique IdentifierFactory of the program (singleton pattern)

◆ getIdentifier() [1/2]

Identifier Diades::Utils::IdentifierFactory::getIdentifier ( unsigned  id)
Parameters
idthe internale id of a Identifier
Returns
the Identifier with the corresponding internal id If such an id does not exist, returns an invalid Identifier

◆ getIdentifier() [2/2]

Identifier Diades::Utils::IdentifierFactory::getIdentifier ( const std::string &  str)
Parameters
stra string
Returns
the Identifier associated to the string str
Precondition
This method WILL fail if str is not a proper identifier (that is a alphabetic character followed by alphabetic,numeric,'_' characters)

◆ typeName()

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

Definition at line 554 of file Identifier.hh.

Member Data Documentation

◆ _dictionary

unordered_map<string,unsigned> Diades::Utils::IdentifierFactory::_dictionary
private

Definition at line 527 of file Identifier.hh.

◆ _identifiers

vector<Identifier> Diades::Utils::IdentifierFactory::_identifiers
private

Definition at line 525 of file Identifier.hh.

◆ _instance

IdentifierFactory* Diades::Utils::IdentifierFactory::_instance
staticprivate

Definition at line 528 of file Identifier.hh.

◆ _rankings

map<double,Identifier> Diades::Utils::IdentifierFactory::_rankings
private

Definition at line 526 of file Identifier.hh.


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