te::dt::DataTypeManager Class Reference

#include <DataTypeManager.h>

Inheritance diagram for te::dt::DataTypeManager:
te::common::Singleton< DataTypeManager >

Classes

struct  IdComparer
 A functor for comparing a pair of pointers to data types by id. More...
 
struct  NameComparer
 A functor for comparing a pair of pointers to data types by name. More...
 

Public Member Functions

int add (const DataType &dt) throw (te::dt::Exception)
 It adds a new data type to the system. More...
 
int add (const std::string &name, const std::string &description) throw (te::dt::Exception)
 It adds a new data type to the system. More...
 
const DataTypefind (int id) const
 It finds a data type having the given id. More...
 
const DataTypefind (const std::string &name) const
 It finds a data type having the given name. More...
 
void remove (const DataType *dt)
 It removes the data type. More...
 

Static Public Member Functions

static DataTypeManagergetInstance ()
 It returns a reference to the singleton instance. More...
 

Protected Member Functions

 DataTypeManager ()
 Constructor for singletons is protected. More...
 
 ~DataTypeManager ()
 Destructor for singletons is protected. More...
 

Private Attributes

std::set< DataType *, NameComparerm_nameIdx
 The set of data types ordered by name. More...
 
std::set< DataType *, IdComparerm_types
 The set of data types ordered by id. More...
 

Static Private Attributes

static int sm_lastId
 The id value of the last inserted data type. More...
 

Friends

class te::common::Singleton< DataTypeManager >
 

Detailed Description

Definition at line 62 of file DataTypeManager.h.

Constructor & Destructor Documentation

te::dt::DataTypeManager::DataTypeManager ( )
protected

Constructor for singletons is protected.

te::dt::DataTypeManager::~DataTypeManager ( )
protected

Destructor for singletons is protected.

Member Function Documentation

int te::dt::DataTypeManager::add ( const DataType dt)
throw (te::dt::Exception
)

It adds a new data type to the system.

Parameters
dtThe data type to be added.
Returns
The id associated to the new data type on success (a number greater than 0).
Exceptions
ExceptionIt throws an exception if a data type with the same name already exists in the system.
Note
Not thread-safe.
int te::dt::DataTypeManager::add ( const std::string &  name,
const std::string &  description 
)
throw (te::dt::Exception
)

It adds a new data type to the system.

Parameters
nameThe new data type name.
descriptionThe data type description.
Returns
The id associated to the new data type on success (a number greater than 0).
Exceptions
ExceptionIt throws an exception if a data type with the same name already exists in the system.
Note
Not thread-safe.
const DataType* te::dt::DataTypeManager::find ( int  id) const

It finds a data type having the given id.

Parameters
idThe data type id.
Returns
The data type having the id or NULL if none is found.
const DataType* te::dt::DataTypeManager::find ( const std::string &  name) const

It finds a data type having the given name.

Parameters
nameThe data type name.
Returns
The data type having the name or NULL if none is found.
static DataTypeManager & te::common::Singleton< DataTypeManager >::getInstance ( )
staticinherited

It returns a reference to the singleton instance.

Returns
A reference to the singleton instance.
void te::dt::DataTypeManager::remove ( const DataType dt)

It removes the data type.

Parameters
dtThe data type.

Friends And Related Function Documentation

friend class te::common::Singleton< DataTypeManager >
friend

Definition at line 64 of file DataTypeManager.h.

Member Data Documentation

std::set<DataType*, NameComparer> te::dt::DataTypeManager::m_nameIdx
private

The set of data types ordered by name.

Definition at line 157 of file DataTypeManager.h.

std::set<DataType*, IdComparer> te::dt::DataTypeManager::m_types
private

The set of data types ordered by id.

Definition at line 156 of file DataTypeManager.h.

int te::dt::DataTypeManager::sm_lastId
staticprivate

The id value of the last inserted data type.

Definition at line 159 of file DataTypeManager.h.


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