27 #include "../common/STLUtils.h"
28 #include "../common/Translator.h"
40 return add(dt.getName(), dt.getDescription());
45 int id = sm_lastId + 1;
47 std::auto_ptr<DataType> dt(
new DataType(
id, name, description));
49 if(m_types.find(dt.get()) != m_types.end())
50 throw Exception(
TE_TR(
"There is already a data type with the given id!"));
52 if(m_nameIdx.find(dt.get()) != m_nameIdx.end())
53 throw Exception(
TE_TR(
"There is already a data type with the given name!"));
55 m_types.insert(dt.get());
56 m_nameIdx.insert(dt.get());
67 std::set<DataType*, IdComparer>::iterator it =
m_types.find((
DataType*)dt);
73 std::set<DataType*, NameComparer>::iterator it2 =
m_nameIdx.find(odt);
86 std::set<DataType*, IdComparer>::const_iterator it = m_types.find(&dummy);
88 if(it != m_types.end())
99 std::set<DataType*, NameComparer>::const_iterator it = m_nameIdx.find(&dummy);
101 if(it != m_nameIdx.end())
It stores information about a data type.
void remove(const DataType *dt)
It removes the data type.
std::set< DataType *, NameComparer > m_nameIdx
The set of data types ordered by name.
An exception class for the DataType module.
#define TE_TR(message)
It marks a string in order to get translated.
DataTypeManager()
Constructor for singletons is protected.
It stores information about a data type.
std::set< DataType *, IdComparer > m_types
The set of data types ordered by id.
static int sm_lastId
The id value of the last inserted data type.
const DataType * find(int id) const
It finds a data type having the given id.
A singleton for managing all data types in the system.
~DataTypeManager()
Destructor for singletons is protected.
int add(const DataType &dt)
It adds a new data type to the system.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...