HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UnitConverter Class Referenceabstract

#include <Unit.h>

+ Inheritance diagram for UnitConverter:

Public Member Functions

 UnitConverter ()
 
virtual ~UnitConverter ()
 
virtual float convert (float input, const string &inputUnit, const string &outputUnit) const =0
 
virtual int getUnitAsInteger (const string &) const
 
virtual string getUnitFromInteger (int) const
 
virtual Vector2 convert (const Vector2 &input, const string &inputUnit, const string &outputUnit) const =0
 
virtual Vector3 convert (const Vector3 &input, const string &inputUnit, const string &outputUnit) const =0
 
virtual Vector4 convert (const Vector4 &input, const string &inputUnit, const string &outputUnit) const =0
 
virtual void write (DocumentPtr doc) const =0
 Create unit definitions in a document based on the converter. More...
 

Detailed Description

An abstract base class for unit converters. Each unit converter instance is responsible for a single unit type.

Definition at line 40 of file Unit.h.

Constructor & Destructor Documentation

UnitConverter::UnitConverter ( )
inline

Definition at line 43 of file Unit.h.

virtual UnitConverter::~UnitConverter ( )
inlinevirtual

Definition at line 44 of file Unit.h.

Member Function Documentation

virtual float UnitConverter::convert ( float  input,
const string inputUnit,
const string outputUnit 
) const
pure virtual

Convert a given value in a given unit to a desired unit

Parameters
inputInput value to convert
inputUnitUnit of input value
outputUnitUnit for output value

Implemented in LinearUnitConverter.

virtual Vector2 UnitConverter::convert ( const Vector2 input,
const string inputUnit,
const string outputUnit 
) const
pure virtual

Convert a given value in a given unit to a desired unit

Parameters
inputInput value to convert
inputUnitUnit of input value
outputUnitUnit for output value

Implemented in LinearUnitConverter.

virtual Vector3 UnitConverter::convert ( const Vector3 input,
const string inputUnit,
const string outputUnit 
) const
pure virtual

Convert a given value in a given unit to a desired unit

Parameters
inputInput value to convert
inputUnitUnit of input value
outputUnitUnit for output value

Implemented in LinearUnitConverter.

virtual Vector4 UnitConverter::convert ( const Vector4 input,
const string inputUnit,
const string outputUnit 
) const
pure virtual

Convert a given value in a given unit to a desired unit

Parameters
inputInput value to convert
inputUnitUnit of input value
outputUnitUnit for output value

Implemented in LinearUnitConverter.

virtual int UnitConverter::getUnitAsInteger ( const string ) const
inlinevirtual

Given a unit name return a value that it can map to as an integer Returns -1 value if not found

Reimplemented in LinearUnitConverter.

Definition at line 54 of file Unit.h.

virtual string UnitConverter::getUnitFromInteger ( int  ) const
inlinevirtual

Given an integer index return the unit name in the map used by the converter Returns Empty string if not found

Reimplemented in LinearUnitConverter.

Definition at line 58 of file Unit.h.

virtual void UnitConverter::write ( DocumentPtr  doc) const
pure virtual

Create unit definitions in a document based on the converter.

Implemented in LinearUnitConverter.


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