mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.

Dependents:   MbedSmartRestMain MbedSmartRestMain

Embed: (wiki syntax)

« Back to documentation index

Value Class Reference

Value Class Reference

A generic value offering means to obtain the value type and contents as well as writing the value to a sink. More...

#include <Value.h>

Public Member Functions

virtual uint8_t valueType () const =0
 Returns the value type which can be VALUE_NULL, VALUE_INTEGER, VALUE_FLOAT or VALUE_CHARACTER.
virtual long integerValue () const =0
 Returns the integer value if an integer type, otherwise zero.
virtual double floatValue () const =0
 Returns the float value if a float type, otherwise zero.
virtual const char * characterValue () const =0
 Returns the character value if a character type, otherwise zero.
virtual size_t write (AbstractDataSink &) const =0
 Writes the value to a sink.
virtual size_t length () const =0
 Returns the number of bytes required to write this value to a sink.
virtual Valuecopy () const =0
 Copies this value to the heap.

Detailed Description

A generic value offering means to obtain the value type and contents as well as writing the value to a sink.

Definition at line 55 of file Value.h.


Member Function Documentation

virtual const char* characterValue (  ) const [pure virtual]

Returns the character value if a character type, otherwise zero.

Returns:
character value
virtual Value* copy (  ) const [pure virtual]

Copies this value to the heap.

Referenced contents must also be copied.

Returns:
a new value instance allocated on the heap
virtual double floatValue (  ) const [pure virtual]

Returns the float value if a float type, otherwise zero.

Returns:
float value
virtual long integerValue (  ) const [pure virtual]

Returns the integer value if an integer type, otherwise zero.

Returns:
integer value
virtual size_t length (  ) const [pure virtual]

Returns the number of bytes required to write this value to a sink.

Returns:
number of bytes required to write this value
virtual uint8_t valueType (  ) const [pure virtual]

Returns the value type which can be VALUE_NULL, VALUE_INTEGER, VALUE_FLOAT or VALUE_CHARACTER.

Returns:
the value type
virtual size_t write ( AbstractDataSink &   ) const [pure virtual]

Writes the value to a sink.

If necessary, quotes and escape characters may be added.

Parameters:
sinkthe sink to write the value to
Returns:
the number of bytes written