powerd++  0.4.4
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{clas.cpp}::Value Struct Reference

Determine the unit of a string encoded value. More...

Public Member Functions

 operator double () const
 Implicitly cast to the magnitude. More...
 
 operator Unit () const
 Implicitly cast to the unit. More...
 
Valueoperator+= (double const off)
 Add offset to the magnitude. More...
 
Valueoperator-= (double const off)
 Subtract offset from the magnitude. More...
 
Valueoperator*= (double const fact)
 Scale magnitude by the given factor. More...
 
Valueoperator/= (double const div)
 Divide the magnitude by the given divisor. More...
 
 Value (char const *const valp, char *unitp=nullptr)
 Construct value from a null terminated character array. More...
 

Public Attributes

double value
 The magnitude of the value.
 
Unit unit
 The unit of the value.
 

Detailed Description

Determine the unit of a string encoded value.

Constructor & Destructor Documentation

◆ Value()

anonymous_namespace{clas.cpp}::Value::Value ( char const *const  valp,
char *  unitp = nullptr 
)
inline

Construct value from a null terminated character array.

Parameters
valpA pointer to the value portion of the array
unitpSet by the constructor to point behind the magnitude

Member Function Documentation

◆ operator double()

anonymous_namespace{clas.cpp}::Value::operator double ( ) const
inline

Implicitly cast to the magnitude.

Returns
The magnitude of the value

◆ operator Unit()

anonymous_namespace{clas.cpp}::Value::operator Unit ( ) const
inline

Implicitly cast to the unit.

Returns
The unit of the value

◆ operator*=()

Value& anonymous_namespace{clas.cpp}::Value::operator*= ( double const  fact)
inline

Scale magnitude by the given factor.

Parameters
factThe factor to scale the magnitude by
Returns
A self reference

◆ operator+=()

Value& anonymous_namespace{clas.cpp}::Value::operator+= ( double const  off)
inline

Add offset to the magnitude.

Parameters
offThe offset value
Returns
A self reference

◆ operator-=()

Value& anonymous_namespace{clas.cpp}::Value::operator-= ( double const  off)
inline

Subtract offset from the magnitude.

Parameters
offThe offset value
Returns
A self reference

◆ operator/=()

Value& anonymous_namespace{clas.cpp}::Value::operator/= ( double const  div)
inline

Divide the magnitude by the given divisor.

Parameters
divThe divisor to divide the magnitude by
Returns
A self reference

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