27 #include "../common/Translator.h"
31 #include <boost/format.hpp>
35 std::pair<int, int> mapping(src, dst);
37 std::map<std::pair<int, int>,
DataTypeConverter>::iterator it = m_convMap.find(mapping);
38 if(it != m_convMap.end())
39 throw Exception((boost::format(
TE_TR(
"There is already a converter registered for the data type conversion: %1% -> %2%.")) % src % dst).str());
41 m_convMap[mapping] = conv;
46 std::map<std::pair<int, int>,
DataTypeConverter>::iterator it = m_convMap.find(typeMap);
47 if(it == m_convMap.end())
48 throw Exception((boost::format(
TE_TR(
"There is not a converter registered for the data type conversion: %1% -> %2%.")) % typeMap.first % typeMap.second).str());
~DataConverterManager()
Destructor.
std::map< std::pair< int, int >, DataTypeConverter > m_convMap
A map: (source-data-type, target-data-type) -> data type converter.
A singleton for managing the data type converter available in the system.
void add(int src, int dst, DataTypeConverter conv)
It adds a converter to the list of known data type mappings.
#define TE_TR(message)
It marks a string in order to get translated.
const DataTypeConverter & get(int src, int dst)
It returns a data type converter for the given source and destination data types. ...
boost::function1< AbstractData *, AbstractData * > DataTypeConverter
The definition of the data type converter.
DataConverterManager()
Constructor.
void clear()
Clear the container.