26 #ifndef __TERRALIB_COMMON_INTERNAL_UNITSOFMEASUREMANAGER_H
27 #define __TERRALIB_COMMON_INTERNAL_UNITSOFMEASUREMANAGER_H
60 typedef std::map<unsigned int, UnitOfMeasurePtr>::const_iterator
const_iterator;
61 typedef std::map<unsigned int, UnitOfMeasurePtr>::iterator
iterator;
140 bool areConvertible(
const std::string& unitFromName,
const std::string& unitToName)
const;
152 double getConversion(
const std::string& unitFromName,
const std::string& unitToName)
const;
196 std::size_t size()
const;
212 std::map<unsigned int, UnitOfMeasurePtr>
m_uoms;
Template support for singleton pattern.
A class for representing a unit of measure.
Template support for singleton pattern.
A singleton class for dealing with units of measure in the TerraLib environment.
std::size_t size() const
It returns the number of units in the manager.
UnitOfMeasurePtr findBySymbol(const std::string &symbol) const
Returns a unit of measure identified by its symbol.
void remove(UnitOfMeasurePtr &uom)
Removes a unit of measure from the manager.
const_iterator end() const
It returns an iterator to the end of the conteiner.
UnitOfMeasurePtr find(const std::string &name) const
Returns a unit of measure identified by its name.
std::map< unsigned int, UnitOfMeasurePtr >::iterator iterator
UnitOfMeasurePtr find(unsigned int id) const
Returns a unit of measure identified by its identificaton.
const_iterator begin() const
It returns an iterator to the beginning of the conteiner.
void getNames(UnitOfMeasurePtr &uom, std::vector< std::string > &names) const
Retrieves the alternative names for a unit of measure.
std::map< unsigned int, UnitOfMeasurePtr > m_uoms
void insert(UnitOfMeasurePtr &uom, const std::vector< std::string > &alternativeNames)
Inserts a new unit of measure to be managed and its alternative names.
UnitsOfMeasureManager()
It initializes the Singleton.
void insert(UnitOfMeasurePtr &uom)
Inserts a new unit of measure to be managed.
std::map< unsigned int, UnitOfMeasurePtr >::const_iterator const_iterator
void init()
It initializes the list of well kown units of measure.
std::map< std::string, unsigned int > m_uomsIdxByName
double getConversion(const std::string &unitFromName, const std::string &unitToName) const
Calculates a multiplicative factor to convert from a given unit to its base unit and vice-versa.
bool areConvertible(const std::string &unitFromName, const std::string &unitToName) const
Check if two units of measure are compatible.
~UnitsOfMeasureManager()
Destructor.
void clear()
Removes all units from the catalogue.
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.