KPN IoT / senml

Fork of kpn_senml by KPN IoT

Embed: (wiki syntax)

« Back to documentation index

SenMLBase Class Reference

SenMLBase Class Reference

the base class for all objects that can be used in the senml data tree. More...

#include <senml_base.h>

Inherited by SenMLPack, and SenMLRecord.

Public Member Functions

SenMLBasegetNext ()
 get the next item in the list.
SenMLBasegetRoot ()
 Get the root object of this list.
virtual void fieldsToJson ()=0
 renders all the fields to json, without the starting and ending brackets.
virtual int fieldsToCbor ()=0
 renders all the fields to cbor format.

Friends

class SenMLPack
class SenMLRecord
class SenMLJsonListener
class SenMLBaseParser

Detailed Description

the base class for all objects that can be used in the senml data tree.

Definition at line 29 of file senml_base.h.


Member Function Documentation

virtual int fieldsToCbor (  ) [pure virtual]

renders all the fields to cbor format.

renders all the fields of the object without the length info at the beginning note: this is public so that custom implementations for the record object can use other objects internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for lat, lon & alt.

Returns:
: The number of bytes that were written.

Implemented in SenMLBinaryRecord, SenMLBoolRecord, SenMLDoublePack, SenMLFloatRecord, SenMLIntPack, SenMLIntRecord, SenMLPack, SenMLRecord, and SenMLStringRecord.

virtual void fieldsToJson (  ) [pure virtual]

renders all the fields to json, without the starting and ending brackets.

Inheriters can extend this function if they want to add extra fields to the json output note: this is public so that custom implementations for the record object can use other objects internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for lat, lon & alt.

Returns:
: None

Implemented in SenMLBinaryRecord, SenMLBoolRecord, SenMLDoublePack, SenMLFloatRecord, SenMLIntPack, SenMLIntRecord, SenMLPack, SenMLRecord, and SenMLStringRecord.

SenMLBase* getNext (  )

get the next item in the list.

Returns:
: a pointer to the next SenMLBase object in the list or NULL when at the end of the list.

Definition at line 42 of file senml_base.h.

SenMLBase * getRoot (  )

Get the root object of this list.

Usually, this is a SenMLPack object. The root object is defined as the first item in the list.

Returns:
: a pointer to the first SenMLBase object in the list or NULL when there is none.

Definition at line 53 of file senml_base.cpp.