HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinearUnitConverter Class Reference

#include <Unit.h>

+ Inheritance diagram for LinearUnitConverter:

Public Member Functions

virtual ~LinearUnitConverter ()
 
const stringgetUnitType () const
 Return the unit type string. More...
 
void write (DocumentPtr doc) const override
 Create unit definitions in a document based on the converter. More...
 
Conversion
const std::unordered_map
< string, float > & 
getUnitScale () const
 
float conversionRatio (const string &inputUnit, const string &outputUnit) const
 
float convert (float input, const string &inputUnit, const string &outputUnit) const override
 
Vector2 convert (const Vector2 &input, const string &inputUnit, const string &outputUnit) const override
 
Vector3 convert (const Vector3 &input, const string &inputUnit, const string &outputUnit) const override
 
Vector4 convert (const Vector4 &input, const string &inputUnit, const string &outputUnit) const override
 
Shader Mapping
int getUnitAsInteger (const string &unitName) const override
 
virtual string getUnitFromInteger (int index) const override
 
- Public Member Functions inherited from UnitConverter
 UnitConverter ()
 
virtual ~UnitConverter ()
 

Static Public Member Functions

static LinearUnitConverterPtr create (UnitTypeDefPtr UnitDef)
 Creator. More...
 

Detailed Description

A converter class for linear units that require only a scalar multiplication.

Definition at line 84 of file Unit.h.

Constructor & Destructor Documentation

virtual LinearUnitConverter::~LinearUnitConverter ( )
inlinevirtual

Definition at line 87 of file Unit.h.

Member Function Documentation

float LinearUnitConverter::conversionRatio ( const string inputUnit,
const string outputUnit 
) const

Ratio between the given unit to a desired unit

Parameters
inputUnitUnit of input value
outputUnitUnit for output value
float LinearUnitConverter::convert ( float  input,
const string inputUnit,
const string outputUnit 
) const
overridevirtual

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

Implements UnitConverter.

Vector2 LinearUnitConverter::convert ( const Vector2 input,
const string inputUnit,
const string outputUnit 
) const
overridevirtual

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

Implements UnitConverter.

Vector3 LinearUnitConverter::convert ( const Vector3 input,
const string inputUnit,
const string outputUnit 
) const
overridevirtual

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

Implements UnitConverter.

Vector4 LinearUnitConverter::convert ( const Vector4 input,
const string inputUnit,
const string outputUnit 
) const
overridevirtual

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

Implements UnitConverter.

static LinearUnitConverterPtr LinearUnitConverter::create ( UnitTypeDefPtr  UnitDef)
static

Creator.

int LinearUnitConverter::getUnitAsInteger ( const string unitName) const
overridevirtual

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

Reimplemented from UnitConverter.

virtual string LinearUnitConverter::getUnitFromInteger ( int  index) const
overridevirtual

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

Reimplemented from UnitConverter.

const std::unordered_map<string, float>& LinearUnitConverter::getUnitScale ( ) const
inline

Return the mappings from unit names to the scale value defined by a linear converter.

Definition at line 106 of file Unit.h.

const string& LinearUnitConverter::getUnitType ( ) const
inline

Return the unit type string.

Definition at line 93 of file Unit.h.

void LinearUnitConverter::write ( DocumentPtr  doc) const
overridevirtual

Create unit definitions in a document based on the converter.

Implements UnitConverter.


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