CHAI SDK  Version 1.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CPNS::Value Class Reference

Value container. More...

Public Member Functions

 Value ()
 Default constructor. More...
 
 Value (Value const &value)
 Copy constructor. More...
 
 Value (CPNS::uint16 const wRawValue, CPNS::boolean const fBipolarRawValue=false)
 Constructor for raw value only. More...
 
 Value (CPNS::uint16 const wRawValue, CPNS::Enums::DataTypes const dataType, void const *const pValue, CPNS::boolean const fBipolarRawValue=false)
 Constructor for raw value + typed value. More...
 
CPNS::boolean operator== (CPNS::Value const &a) const
 Operator ==. More...
 
CPNS::uint16 GetRawValue () const
 Get raw value. More...
 
CPNS::boolean IsRawValueBipolar () const
 Tells if the raw value is bipolar. More...
 
CPNS::Enums::DataTypes GetDataType () const
 Get data type. More...
 
CPNS::uint16 GetUInt16 () const
 Get Unsigned Int 16 value. More...
 
CPNS::uint32 GetUInt32 () const
 Get Unsigned Int 32 value. More...
 
CPNS::uint64 GetUInt64 () const
 Get Unsigned Int 64 value. More...
 
CPNS::int16 GetInt16 () const
 Get Int 16 value. More...
 
CPNS::int32 GetInt32 () const
 Get Int 32 value. More...
 
CPNS::int64 GetInt64 () const
 Get Int 64 value. More...
 
CPNS::float32 GetFloat32 () const
 Get Float 32 value. More...
 
CPNS::float64 GetFloat64 () const
 Get Float 64 value. More...
 
CPNS::uint8 * GetBuffer () const
 Get value buffer. More...
 
void SetRawValue (CPNS::uint16 const wRawValue, CPNS::boolean const fBipolarRawValue=false)
 Set raw value. More...
 
void SetValue (CPNS::uint16 const wRawValue, CPNS::Enums::DataTypes const dataType, void const *const pValue, CPNS::boolean const fBipolarRawValue=false)
 Set raw value and typed value. More...
 
CPNS::Enums::Errors SetUInt16 (CPNS::Enums::DataTypes const dataType, CPNS::uint16 const wValue)
 Set unsigned int 16 typed value. More...
 
CPNS::Enums::Errors SetUInt32 (CPNS::Enums::DataTypes const dataType, CPNS::uint32 const dwValue)
 Set unsigned int 32 typed value. More...
 
CPNS::Enums::Errors SetUInt64 (CPNS::Enums::DataTypes const dataType, CPNS::uint64 const qwValue)
 Set unsigned int 64 typed value. More...
 
CPNS::Enums::Errors SetInt16 (CPNS::Enums::DataTypes const dataType, CPNS::int16 const sValue)
 Set signed int 16 typed value. More...
 
CPNS::Enums::Errors SetInt32 (CPNS::Enums::DataTypes const dataType, CPNS::int32 const lValue)
 Set signed int 32 typed value. More...
 
CPNS::Enums::Errors SetInt64 (CPNS::Enums::DataTypes const dataType, CPNS::int64 const qlValue)
 Set signed int 64 typed value. More...
 
CPNS::Enums::Errors SetFloat32 (CPNS::Enums::DataTypes const dataType, CPNS::float32 const fValue)
 Set float 32 typed value. More...
 
CPNS::Enums::Errors SetFloat64 (CPNS::Enums::DataTypes const dataType, CPNS::float64 const dValue)
 Set float 64 typed value. More...
 

Detailed Description

Value container.

Used to manipulate multi-format data.

Constructor & Destructor Documentation

CPNS::Value::Value ( )

Default constructor.

CPNS::Value::Value ( Value const &  value)

Copy constructor.

Parameters
[in]valuesource value
CPNS::Value::Value ( CPNS::uint16 const  wRawValue,
CPNS::boolean const  fBipolarRawValue = false 
)

Constructor for raw value only.

Parameters
[in]wRawValueEncoded in DT_Knob16 or MKZ16 data type, this is the 16 bits view of the data exposed in the specified data type.
[in]fBipolarRawValueTRUE if the raw value is encoded in MKZ16 (0x0001 = -range, 0x8000 = zero, 0xFFFF = +range)
CPNS::Value::Value ( CPNS::uint16 const  wRawValue,
CPNS::Enums::DataTypes const  dataType,
void const *const  pValue,
CPNS::boolean const  fBipolarRawValue = false 
)

Constructor for raw value + typed value.

Parameters
[in]wRawValueEncoded in DT_Knob16 or MKZ16 data type, this is the 16 bits view of the data exposed in the specified data type.
[in]dataTypeTyped value data type
[in]pValuePointer to the variable containing value.
[in]fBipolarRawValueTRUE if the raw value is encoded in MKZ16 (0x0001 = -range, 0x8000 = zero, 0xFFFF = +range)
Warning
dataType must match memory area size pointed by pValue! Specifying mismatching dataType/pValue might trigger a memory access failure!

Member Function Documentation

CPNS::uint8* CPNS::Value::GetBuffer ( ) const

Get value buffer.

Returns
a CPNS::uint8* pointer.
CPNS::Enums::DataTypes CPNS::Value::GetDataType ( ) const

Get data type.

Returns
CPNS::Enums::DT_* value.
CPNS::float32 CPNS::Value::GetFloat32 ( ) const

Get Float 32 value.

To be used in case of 32 bits data type.

Returns
a CPNS::float32 value.
CPNS::float64 CPNS::Value::GetFloat64 ( ) const

Get Float 64 value.

To be used in case of 64 bits data type.

Returns
a CPNS::float64 value.
CPNS::int16 CPNS::Value::GetInt16 ( ) const

Get Int 16 value.

To be used in case of 16 bits data type.

Returns
a CPNS::int16 value.
CPNS::int32 CPNS::Value::GetInt32 ( ) const

Get Int 32 value.

To be used in case of 32 bits data type.

Returns
a CPNS::int32 value.
CPNS::int64 CPNS::Value::GetInt64 ( ) const

Get Int 64 value.

To be used in case of 64 bits data type.

Returns
a CPNS::int64 value.
CPNS::uint16 CPNS::Value::GetRawValue ( ) const

Get raw value.

Returns
a DT_Knob16 raw value embedded in the Value.
CPNS::uint16 CPNS::Value::GetUInt16 ( ) const

Get Unsigned Int 16 value.

To be used in case of 16 bits data type.

Returns
a CPNS::uint16 value.
CPNS::uint32 CPNS::Value::GetUInt32 ( ) const

Get Unsigned Int 32 value.

To be used in case of 32 bits data type.

Returns
a CPNS::uint32 value.
CPNS::uint64 CPNS::Value::GetUInt64 ( ) const

Get Unsigned Int 64 value.

To be used in case of 64 bits data type.

Returns
a CPNS::uint64 value.
CPNS::boolean CPNS::Value::IsRawValueBipolar ( ) const

Tells if the raw value is bipolar.

Returns
TRUE if the raw value is encoded in MKZ16
CPNS::boolean CPNS::Value::operator== ( CPNS::Value const &  a) const

Operator ==.

Parameters
[in]acompared value
Returns
TRUE if both values are identical
CPNS::Enums::Errors CPNS::Value::SetFloat32 ( CPNS::Enums::DataTypes const  dataType,
CPNS::float32 const  fValue 
)

Set float 32 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_32
[in]fValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetFloat64 ( CPNS::Enums::DataTypes const  dataType,
CPNS::float64 const  dValue 
)

Set float 64 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_64
[in]dValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetInt16 ( CPNS::Enums::DataTypes const  dataType,
CPNS::int16 const  sValue 
)

Set signed int 16 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_16
[in]sValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetInt32 ( CPNS::Enums::DataTypes const  dataType,
CPNS::int32 const  lValue 
)

Set signed int 32 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_32
[in]lValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetInt64 ( CPNS::Enums::DataTypes const  dataType,
CPNS::int64 const  qlValue 
)

Set signed int 64 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_64
[in]qlValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
void CPNS::Value::SetRawValue ( CPNS::uint16 const  wRawValue,
CPNS::boolean const  fBipolarRawValue = false 
)

Set raw value.

Parameters
[in]wRawValueEncoded in DT_Knob16 or MKZ16 data type, this is the 16 bits view of the data exposed in the specified data type.
[in]fBipolarRawValueTRUE if the raw value is encoded in MKZ16 (0x0001 = -range, 0x8000 = zero, 0xFFFF = +range)
CPNS::Enums::Errors CPNS::Value::SetUInt16 ( CPNS::Enums::DataTypes const  dataType,
CPNS::uint16 const  wValue 
)

Set unsigned int 16 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_16
[in]wValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetUInt32 ( CPNS::Enums::DataTypes const  dataType,
CPNS::uint32 const  dwValue 
)

Set unsigned int 32 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_32
[in]dwValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
CPNS::Enums::Errors CPNS::Value::SetUInt64 ( CPNS::Enums::DataTypes const  dataType,
CPNS::uint64 const  qwValue 
)

Set unsigned int 64 typed value.

Parameters
[in]dataTypeTyped value data type, high nibble must be DTL_64
[in]qwValueTyped value.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_InvalidType
void CPNS::Value::SetValue ( CPNS::uint16 const  wRawValue,
CPNS::Enums::DataTypes const  dataType,
void const *const  pValue,
CPNS::boolean const  fBipolarRawValue = false 
)

Set raw value and typed value.

Parameters
[in]wRawValueEncoded in DT_Knob16 or MKZ16 data type, this is the 16 bits view of the data exposed in the specified data type.
[in]dataTypeTyped value data type
[in]pValuePointer to the variable containing value.
[in]fBipolarRawValueTRUE if the raw value is encoded in MKZ16 (0x0001 = -range, 0x8000 = zero, 0xFFFF = +range)
Warning
dataType must match memory area size pointed by pValue! Specifying mismatching dataType/pValue might trigger a memory access failure!