openDAQ
Open data acquisition platform
UnitPtr Class Reference

Describes a measurement unit with IDs as defined in Codes for Units of Measurement used in International Trade. Unit objects implement the Struct methods internally and are Core type ctStruct. More...

Inherits ObjectPtr< IUnit >.

Detailed Description

Describes a measurement unit with IDs as defined in Codes for Units of Measurement used in International Trade. Unit objects implement the Struct methods internally and are Core type ctStruct.

Unit components

  • ID: The unit ID as defined in Codes for Units of Measurement used in International Trade. Should be set to -1 if the unit ID is not available.
  • Symbol: The symbol of the unit, i.e. "m/s". It is mandatory and must be set before the Unit object is frozen.
  • Name: The full name of the unit, i.e. "meters per second". The unit's name is optional.
  • Quantity: The quantity represented by the unit, i.e. "Velocity". The unit's quantity is optional.

Public Member Functions

daq::Int getId () const
 Gets the unit ID as defined in Codes for Units of Measurement used in International Trade. More...
 
daq::StringPtr getSymbol () const
 Gets the symbol of the unit, i.e. "m/s". More...
 
daq::StringPtr getName () const
 Gets the full name of the unit, i.e. "meters per second". More...
 
daq::StringPtr getQuantity () const
 Gets the quantity represented by the unit, i.e. "Velocity". More...
 

Member Function Documentation

◆ getId()

daq::Int getId ( ) const
inline

Gets the unit ID as defined in Codes for Units of Measurement used in International Trade.

Returns
The unit ID.

Returns -1 if the unit id is not available.

◆ getName()

daq::StringPtr getName ( ) const
inline

Gets the full name of the unit, i.e. "meters per second".

Returns
The unit's full name.

nullptr if not set.

◆ getQuantity()

daq::StringPtr getQuantity ( ) const
inline

Gets the quantity represented by the unit, i.e. "Velocity".

Returns
The unit's quantity.

nullptr if not set.

◆ getSymbol()

daq::StringPtr getSymbol ( ) const
inline

Gets the symbol of the unit, i.e. "m/s".

Returns
The unit's symbol.