RuntimeStreamContentDataObject

class kanzi::connect::RuntimeStreamContentDataObject

Wraps a protobuffer object.

Public Functions

inline RuntimeStreamContentDataObject(ContentDataObject *object, bool takeOwnership = true)

C++ constructor.

Parameters

object – object to wrap.

virtual ~RuntimeStreamContentDataObject()

C++ destructor.

RuntimeStreamContentDataObject addChild()

Insert a child object.

Returns

wrapped child object.

int childCount() const

Retrieves amount of childs.

Returns

size

void freeObject()

Retrieve wrapped content data object.

RuntimeStreamContentDataList getChilds()

Retrieves a childs.

Returns

the list referring to childs.

uint32_t getHash() const

Retrieve the hash.

Returns

hash code.

const string &getName() const

Retrieve name.

Returns

name.

int32_t getType() const

Retrieve the type.

Returns

type

bool getValueBool() const

Retrieve boolean value.

Returns

boolean value.

int getValueInt() const

Retrieve int value.

Returns

integer value.

double getValueReal() const

Retrieve real value.

Returns

real value.

const string &getValueString() const

Retrieve string value.

Returns

string value.

bool hasSelf() const

Is the self structure defined.

Returns

true if self defined.

bool identifiedByHash() const

Checks whether this object is identified by hash or by name.

Returns

true if identified by hash, otherwise object is identified by name

void reset()

clears the contents.

string serializeToString()

Serializes the object to string.

Returns

object-tree serialized as string

void setHash(uint32_t hash)

Set hash.

Parameters

sets – the hash.

void setName(const string &name)

Set name.

Parameters

name – the name

void setType(int32_t type)

Sets type.

Parameters

type – the type.

void setValueBool(bool value)

Set bool value.

Parameters

value – value to set

void setValueInt(int32_t value)

Set int value.

Parameters

value – value to set

void setValueReal(double value)

Set real value.

Parameters

value – value to set

void setValueString(const string &value)

Set string value.

Parameters

value – value to set

bool valid() const

Checks is the object valid and whether it holds a valid pointer.

Returns

true if valid.

Public Static Functions

static RuntimeStreamContentDataObject create()

Creates object.

This allocates a new wrapped object which is owned by the returned instance.

Returns

newly created object.

static RuntimeStreamContentDataObject parseFromString(const string &stream)

Parses a stream and creates an object that contains the tree.

Method can fail and thus after calling it should be checked that the object is valid.

auto object = RuntimeStreamContentDataObject::parseFromString(stream);
if (object.valid()) {
   // work with object
}

Parameters

stream – the stream to input

Returns

true