![]() |
MaterialX 1.39.4
|
A registry for unit converters. More...
#include <Unit.h>
Public Member Functions | |
| bool | addUnitConverter (UnitTypeDefPtr def, UnitConverterPtr converter) |
| Add a unit converter for a given UnitDef. | |
| bool | removeUnitConverter (UnitTypeDefPtr def) |
| Remove a unit converter for a given UnitDef. | |
| UnitConverterPtr | getUnitConverter (UnitTypeDefPtr def) |
| Get a unit converter for a given UnitDef Returns any empty pointer if a converter does not exist for the given UnitDef. | |
| void | clearUnitConverters () |
| Clear all unit converters from the registry. | |
| int | getUnitAsInteger (const string &unitName) const |
| Given a unit name return a value that it can map to as an integer Returns -1 value if not found. | |
| void | write (DocumentPtr doc) const |
| Create unit definitions in a document based on registered converters. | |
| bool | convertToUnit (DocumentPtr doc, const string &unitType, const string &targetUnit) |
| Convert input values which have a source unit to a given target unit. | |
Static Public Member Functions | |
| static UnitConverterRegistryPtr | create () |
| Creator. | |
A registry for unit converters.
| bool addUnitConverter | ( | UnitTypeDefPtr | def, |
| UnitConverterPtr | converter ) |
| bool convertToUnit | ( | DocumentPtr | doc, |
| const string & | unitType, | ||
| const string & | targetUnit ) |
Convert input values which have a source unit to a given target unit.
Returns if any unit conversion occurred.
| bool removeUnitConverter | ( | UnitTypeDefPtr | def | ) |