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.

Return

wrapped child object.

int childCount() const

Retrieves amount of childs.

Return

size

void freeObject()

Retrieve wrapped content data object.

RuntimeStreamContentDataList getChilds()

Retrieves a childs.

Return

the list referring to childs.

uint32_t getHash() const

Retrieve the hash.

Return

hash code.

const string &getName() const

Retrieve name.

Return

name.

int32_t getType() const

Retrieve the type.

Return

type

bool getValueBool() const

Retrieve boolean value.

Return

boolean value.

int getValueInt() const

Retrieve int value.

Return

integer value.

double getValueReal() const

Retrieve real value.

Return

real value.

const string &getValueString() const

Retrieve string value.

Return

string value.

bool hasSelf() const

Is the self structure defined.

Return

true if self defined.

bool identifiedByHash() const

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

Return

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

void reset()

clears the contents.

string serializeToString()

Serializes the object to string.

Return

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.

Return

true if valid.

Public Static Functions

static RuntimeStreamContentDataObject create()

Creates object.

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

Return

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
}
Return

true

Parameters
  • stream: the stream to input