RuntimeDataObject is a base class for hierarchical runtime data. More...
#include <runtimedataobject.hpp>
Public Types | |
| typedef ChildContainer::const_iterator | ChildConstIterator |
| typedef ChildContainer::const_reverse_iterator | ChildConstReverseIterator |
| typedef vector< RuntimeDataObjectSharedPtr > | ChildContainer |
| Iterators for children. More... | |
| typedef function< void(RuntimeDataObject *self)> | ModifiedFunction |
| Callback function type for change subscriptions. More... | |
| typedef shared_ptr< void > | ModifiedSubscriptionToken |
| Token type that can be used to identify the change subscription. More... | |
| enum | Persistence { Persistence::NON_PERSISTENT, Persistence::PERSISTENT } |
| Is the runtime data object persistent or not. More... | |
| enum | Type { Object = 0, Integer = 1, Real = 2, Bool = 3, String = 4, List = 6, Unknown = 100 } |
| Type enumerations for different data object types. More... | |
Public Member Functions | |
| void | addChild (const RuntimeDataObjectSharedPtr &child) |
| Adds data object as child of this object. More... | |
| ModifiedSubscriptionToken | addModifiedNotificationHandler (ModifiedFunction callback) |
| Allows to subscribe to modifications in this data context. More... | |
| ChildConstIterator | beginChildren () const |
| Returns iterator to start of the child container. More... | |
| template<typename _ToClass > | |
| shared_ptr< _ToClass > | castTo () |
| Cast this object to specific type. More... | |
| virtual RuntimeDataObjectSharedPtr | clone () |
| Clones an object and creates exact duplicate of it. More... | |
| void | copyDataFrom (RuntimeDataObject &from) |
| Copies basic data from provided object. More... | |
| virtual bool | copyValueFrom (RuntimeDataObjectSharedPtr other) |
| Copies a value from other object. More... | |
| bool | createChild (const string &name, const RuntimeDataObject::Type dataType, const string &serializedDefaultValue, const bool persistent, const bool writable, const persistence::SettingFactory *settingFactory) |
| Create a child under this runtime data object. More... | |
| bool | createChildRecursive (const string &path, RuntimeDataObject::Type dataType, const string &serializedDefaultValue, const bool persistent, const bool writable, const persistence::SettingFactory *settingFactory) |
| Create a child data object in the correct place in hierarchy specified by path. More... | |
| RuntimeDataObjectSharedPtr | createPathObjects (const string &path, const persistence::SettingFactory *settingFactory) |
| Create objects enough to have the given path in the runtime data and return the leaf object All created objects are of Type::Object. More... | |
| ChildConstIterator | endChildren () const |
| Returns iterator in the end of the child container. More... | |
| virtual bool | equals (RuntimeDataObjectSharedPtr other) |
| Compares objects and returns true if objects, including childs, are equal. More... | |
| RuntimeDataObjectSharedPtr | findChild (const string &name) |
| Tries to find a child with given name. More... | |
| RuntimeDataObjectSharedPtr | findChild (uint32_t hash) |
| Tries to find a child with given name hash code. More... | |
| template<typename _T > | |
| shared_ptr< _T > | findChild (const string &name) |
| Retrieve a typed children with specific name. More... | |
| template<typename _T > | |
| shared_ptr< _T > | findChild (uint32_t hash) |
| Retrieve a typed children with specific name hash code. More... | |
| RuntimeDataObjectSharedPtr | findChildRecursive (const string &path, bool passLists=true) |
| Locates childs recursively. More... | |
| template<typename _T > | |
| shared_ptr< _T > | findChildRecursive (const string &path, bool passLists=true) |
| Locates childs recursively. More... | |
| RuntimeDataObjectSharedPtr | getChild (size_t index) const |
| Retrieves a child object in given index. More... | |
| template<typename _T > | |
| shared_ptr< _T > | getChild (size_t index) const |
| size_t | getChildCount () const |
| Retrieves the count of child objects in this data object. More... | |
| size_t | getChildIndex (const RuntimeDataObject &child) const |
| Retrieves the index of a child data object. More... | |
| virtual string | getDefaultValueStr () const |
| Virtual function which exists in this base class but should never be used. This is overridden in classes where its appropriate. More... | |
| void | getFreeformProperties (vector< pair< string, string > > &output) |
| Get list of the free form properties defined for the object output The freeform properties will be copied here,. More... | |
| int | getIntProperty (const string &name, int defaultValue=0) const |
| Retrieve int property value. More... | |
| string | getName () const |
| Allows to retrieve the name of the object. More... | |
| virtual uint32_t | getNameHash () |
| retrieve hash code for the name portion of node More... | |
| string | getNameOverride () const |
| Retrieve the overriden name. More... | |
| const string & | getPath () const |
| virtual string | getSerializedValue () const |
| Get the runtimedata object value in serialized format. More... | |
| string | getStringProperty (const string &name, const string defaultValue="") const |
| Retrieve string property value. More... | |
| virtual Type | getType () const |
| Allows to retrieve the type of the object. More... | |
| template<typename _ToClass > | |
| shared_ptr< _ToClass > | getUIDelegate () |
| Retrieve UI Delegate and cast it to approriate type. More... | |
| ModifiedSubscriptionToken | getUIDelegateModificationHandlerToken () const |
| Retrieve UI Delegate specific modification handlers registration token. More... | |
| bool | getWritable () const |
| Retrieve writable status. More... | |
| bool | hasChild (const RuntimeDataObject &child) const |
| Checks whether or not the child exists. More... | |
| bool | hasProperty (const string &name) |
| Checks whether there is a property with given name. More... | |
| virtual void | notifyModified (RuntimeDataObject *object=0) |
| Triggers modification procedure in this data context, which invokes the subscriptions. More... | |
| virtual void | removeAllChildren () |
| Removes all children. More... | |
| virtual void | removeChild (const RuntimeDataObject &child) |
| Removes a child object from list of childs. More... | |
| virtual void | removeChild (size_t index) |
| Removes a child object in given index. More... | |
| virtual bool | removeChild (const string &name) |
| Remove specified child of this object. More... | |
| bool | removeChildRecursive (const string &path) |
| Remove specified child and all elements in the path that would become empty. More... | |
| void | removeModifiedNotificationHandler (ModifiedSubscriptionToken token) |
| Allows to unsubscribe from modifications in this data context. More... | |
| void | removeProperty (const string &name) |
| Removes a property with specific name. More... | |
| RuntimeDataObject (ConnectDomain *domain, const string &name, const string nameOverride="") | |
| Standard constructor. More... | |
| RuntimeDataObject (ConnectDomain *domain, const string &path, const string &name, const string nameOverride) | |
| Standard constructor. More... | |
| void | setName (const string &value) |
| Sets the name of the object. More... | |
| void | setNameOverride (const string &value) |
| Sets the overriden name of the object. More... | |
| void | setProperty (const string &name, const string &value) |
| Sets a local property - this information is not serialized. More... | |
| void | setProperty (const string &name, int value) |
| Sets a local property - this information is not serialized. More... | |
| bool | setSerializedValue (const string &serializedValue) |
| Set the value for this data object, if this is not typed or list type then this will fail. More... | |
| void | setUIDelegateModificationHandlerToken (ModifiedSubscriptionToken token) |
| Store UI Delegate modification handler handle. More... | |
| void | setUIDelegete (shared_ptr< DataObject > deleg) |
| Configures UI Delegate object for this content object. More... | |
| void | setWritable (bool writable) |
| Set writable flag. More... | |
| virtual | ~RuntimeDataObject () |
| C++ destructor. More... | |
Static Public Member Functions | |
| static bool | isFreeformProperty (const string &propertyName) |
| Checks whether the named property is one of the defined properties or not. More... | |
| static Type | str2Type (const string &str) |
| Convert a string to Type. More... | |
| static string | type2Str (const Type type) |
| Convert the type enumeration value to human readable string. More... | |
Protected Types | |
| typedef unordered_map< RuntimeDataObjectSharedPtr, ModifiedSubscriptionToken > | ChildrenSubscriptionContainer |
Protected Attributes | |
| ChildContainer | m_children |
| Children of the data object. More... | |
| ChildrenSubscriptionContainer | m_childrenSubscriptionTokens |
| ConnectDomain * | m_domain |
| The connect domain this dataobject is bound to. More... | |
| string | m_name |
| Name of the object. More... | |
| uint32_t | m_nameHash |
| Hash code of the name. More... | |
| string | m_nameOverride |
| UI Override for the name. More... | |
| string | m_path |
| Contains the full path of the object and its parents. More... | |
| optional< map< string, string > > | m_properties |
| Free form properties set for the object. More... | |
| Type | m_type |
| Possible type. More... | |
| weak_ptr< DataObject > | m_UIDelegate |
| UI class, kept as unknown here, just a pointer. More... | |
| ModifiedSubscriptionToken | m_UIDelegateModificationToken |
| Token for modification registrations of UI Delegate. More... | |
| bool | m_writable |
| Is the object value externally writable (over the net) More... | |
RuntimeDataObject is a base class for hierarchical runtime data.
| typedef ChildContainer::const_iterator kanzi::connect::RuntimeDataObject::ChildConstIterator |
| typedef ChildContainer::const_reverse_iterator kanzi::connect::RuntimeDataObject::ChildConstReverseIterator |
Iterators for children.
|
protected |
| typedef function<void(RuntimeDataObject* self)> kanzi::connect::RuntimeDataObject::ModifiedFunction |
Callback function type for change subscriptions.
| typedef shared_ptr<void> kanzi::connect::RuntimeDataObject::ModifiedSubscriptionToken |
Token type that can be used to identify the change subscription.
|
strong |
|
explicit |
Standard constructor.
| domain | connect domain |
| name | Name of the data object. |
| nameOverride | overridden name of the object. |
|
explicit |
Standard constructor.
| domain | connect domain |
| path | Path that contains names of the parents separated with '.' |
| name | Name of the data object. |
| nameOverride | overridden name of the object. |
|
virtual |
C++ destructor.
| void kanzi::connect::RuntimeDataObject::addChild | ( | const RuntimeDataObjectSharedPtr & | child | ) |
Adds data object as child of this object.
| child | Child object to add. |
| ModifiedSubscriptionToken kanzi::connect::RuntimeDataObject::addModifiedNotificationHandler | ( | ModifiedFunction | callback | ) |
Allows to subscribe to modifications in this data context.
| callback | Callback that is invoked when a change occurs in this data context. |
| ChildConstIterator kanzi::connect::RuntimeDataObject::beginChildren | ( | ) | const |
Returns iterator to start of the child container.
|
inline |
Cast this object to specific type.
|
virtual |
Clones an object and creates exact duplicate of it.
How ever, possible modification subscriptions are not duplicated.
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >, and kanzi::connect::RuntimeDataObjectList.
| void kanzi::connect::RuntimeDataObject::copyDataFrom | ( | RuntimeDataObject & | from | ) |
Copies basic data from provided object.
| from | where the copying is done from. |
|
virtual |
Copies a value from other object.
| other | the object where-from copying takes place |
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >.
| bool kanzi::connect::RuntimeDataObject::createChild | ( | const string & | name, |
| const RuntimeDataObject::Type | dataType, | ||
| const string & | serializedDefaultValue, | ||
| const bool | persistent, | ||
| const bool | writable, | ||
| const persistence::SettingFactory * | settingFactory | ||
| ) |
Create a child under this runtime data object.
| name | The name of the child |
| dataType | The data type of the child |
| serializedDefaultValue | The default value in serialized format, to be deserialized based on given data type |
| persistent | Is the element persisted over reboots |
| writable | Should the element have modifier method (used by code generation only) |
| settingFactory | Used to create children with persistent values |
| bool kanzi::connect::RuntimeDataObject::createChildRecursive | ( | const string & | path, |
| RuntimeDataObject::Type | dataType, | ||
| const string & | serializedDefaultValue, | ||
| const bool | persistent, | ||
| const bool | writable, | ||
| const persistence::SettingFactory * | settingFactory | ||
| ) |
Create a child data object in the correct place in hierarchy specified by path.
| path | Specifies the location of the child, if needed then intermediate layers are created on the way |
| dataType | The data type of the child |
| serializedDefaultValue | The default value in serialized format, to be deserialized based on given data type |
| persistent | Is the element persisted over reboots |
| writable | Should the element have modifier method (used by code generation only) |
| settingFactory | Used to create children with persistent values |
| RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObject::createPathObjects | ( | const string & | path, |
| const persistence::SettingFactory * | settingFactory | ||
| ) |
Create objects enough to have the given path in the runtime data and return the leaf object All created objects are of Type::Object.
| path | Identifies the objects to create |
| settingFactory | Used to create children with persistent values (passed to future children, not used directly) |
| ChildConstIterator kanzi::connect::RuntimeDataObject::endChildren | ( | ) | const |
Returns iterator in the end of the child container.
|
virtual |
Compares objects and returns true if objects, including childs, are equal.
| other | where to compare |
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >, and kanzi::connect::RuntimeDataObjectList.
| RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObject::findChild | ( | const string & | name | ) |
Tries to find a child with given name.
| RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObject::findChild | ( | uint32_t | hash | ) |
Tries to find a child with given name hash code.
| hash | the hashcode to be used in lookup. |
|
inline |
Retrieve a typed children with specific name.
| name | the name of children to look for |
|
inline |
Retrieve a typed children with specific name hash code.
| hash | The hash of the children to look for. |
| RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObject::findChildRecursive | ( | const string & | path, |
| bool | passLists = true |
||
| ) |
Locates childs recursively.
| path | full path to object, items separated with dot ('.'). i.e. Engine.Speed |
| passLists | whether to go over lists. |
|
inline |
Locates childs recursively.
| path | full path to object, items separated with dot ('.'). i.e. Engine.Speed |
| passLists | whether to go over lists. |
| RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObject::getChild | ( | size_t | index | ) | const |
Retrieves a child object in given index.
|
inline |
| size_t kanzi::connect::RuntimeDataObject::getChildCount | ( | ) | const |
Retrieves the count of child objects in this data object.
| size_t kanzi::connect::RuntimeDataObject::getChildIndex | ( | const RuntimeDataObject & | child | ) | const |
Retrieves the index of a child data object.
|
inlinevirtual |
Virtual function which exists in this base class but should never be used. This is overridden in classes where its appropriate.
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >.
| void kanzi::connect::RuntimeDataObject::getFreeformProperties | ( | vector< pair< string, string > > & | output | ) |
Get list of the free form properties defined for the object output The freeform properties will be copied here,.
| int kanzi::connect::RuntimeDataObject::getIntProperty | ( | const string & | name, |
| int | defaultValue = 0 |
||
| ) | const |
Retrieve int property value.
| name | the name of the property |
| defaultValue | the value for the property |
| string kanzi::connect::RuntimeDataObject::getName | ( | ) | const |
Allows to retrieve the name of the object.
|
virtual |
retrieve hash code for the name portion of node
| string kanzi::connect::RuntimeDataObject::getNameOverride | ( | ) | const |
Retrieve the overriden name.
| const string& kanzi::connect::RuntimeDataObject::getPath | ( | ) | const |
|
virtual |
Get the runtimedata object value in serialized format.
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >.
| string kanzi::connect::RuntimeDataObject::getStringProperty | ( | const string & | name, |
| const string | defaultValue = "" |
||
| ) | const |
Retrieve string property value.
| name | the name of the property |
| defaultValue | the value for the property |
|
inlinevirtual |
Allows to retrieve the type of the object.
Reimplemented in kanzi::connect::RuntimeDataObjectTyped< DataType, DataTypeEnum >, and kanzi::connect::RuntimeDataObjectList.
|
inline |
Retrieve UI Delegate and cast it to approriate type.
| ModifiedSubscriptionToken kanzi::connect::RuntimeDataObject::getUIDelegateModificationHandlerToken | ( | ) | const |
Retrieve UI Delegate specific modification handlers registration token.
| bool kanzi::connect::RuntimeDataObject::getWritable | ( | ) | const |
Retrieve writable status.
| bool kanzi::connect::RuntimeDataObject::hasChild | ( | const RuntimeDataObject & | child | ) | const |
Checks whether or not the child exists.
| bool kanzi::connect::RuntimeDataObject::hasProperty | ( | const string & | name | ) |
Checks whether there is a property with given name.
| name | the name to check. |
|
static |
Checks whether the named property is one of the defined properties or not.
| propertyName | Identifies what kind of property is |
|
virtual |
Triggers modification procedure in this data context, which invokes the subscriptions.
Should be called by derived classes whenever the value of the object is changed.
|
virtual |
Removes all children.
Reimplemented in kanzi::connect::RuntimeDataObjectList.
|
virtual |
Removes a child object from list of childs.
| child | Child object to remove. |
Reimplemented in kanzi::connect::RuntimeDataObjectList.
|
virtual |
Removes a child object in given index.
| index | The index of the child object to remove. |
Reimplemented in kanzi::connect::RuntimeDataObjectList.
|
virtual |
Remove specified child of this object.
| name | Identifies the child to remove |
| bool kanzi::connect::RuntimeDataObject::removeChildRecursive | ( | const string & | path | ) |
Remove specified child and all elements in the path that would become empty.
| path | Identifies the element to remove |
| void kanzi::connect::RuntimeDataObject::removeModifiedNotificationHandler | ( | ModifiedSubscriptionToken | token | ) |
Allows to unsubscribe from modifications in this data context.
| token | Token to identify the subscription that should be removed. |
| void kanzi::connect::RuntimeDataObject::removeProperty | ( | const string & | name | ) |
Removes a property with specific name.
| name | the name of the property to remove. |
| void kanzi::connect::RuntimeDataObject::setName | ( | const string & | value | ) |
Sets the name of the object.
| value | New name that is assigned to object. |
| void kanzi::connect::RuntimeDataObject::setNameOverride | ( | const string & | value | ) |
Sets the overriden name of the object.
| value | New name that is assigned to object. |
| void kanzi::connect::RuntimeDataObject::setProperty | ( | const string & | name, |
| const string & | value | ||
| ) |
Sets a local property - this information is not serialized.
| name | name of the property |
| value | the value for the property. |
| void kanzi::connect::RuntimeDataObject::setProperty | ( | const string & | name, |
| int | value | ||
| ) |
Sets a local property - this information is not serialized.
| name | the name of the property |
| value | the value of the property |
| bool kanzi::connect::RuntimeDataObject::setSerializedValue | ( | const string & | serializedValue | ) |
Set the value for this data object, if this is not typed or list type then this will fail.
| serializedValue | Contains the data value to set in serialized format |
| void kanzi::connect::RuntimeDataObject::setUIDelegateModificationHandlerToken | ( | ModifiedSubscriptionToken | token | ) |
Store UI Delegate modification handler handle.
| token | the token to store |
|
inline |
Configures UI Delegate object for this content object.
| deleg | delegate object |
| void kanzi::connect::RuntimeDataObject::setWritable | ( | bool | writable | ) |
Set writable flag.
| writable | state |
|
static |
Convert a string to Type.
| str | Contains the data type, interchangeable with type2Str |
|
static |
Convert the type enumeration value to human readable string.
| type | The enumeration value to convert |
|
protected |
Children of the data object.
|
protected |
|
protected |
The connect domain this dataobject is bound to.
|
protected |
Name of the object.
|
protected |
Hash code of the name.
|
protected |
UI Override for the name.
|
protected |
Contains the full path of the object and its parents.
|
protected |
Free form properties set for the object.
|
protected |
Possible type.
|
protected |
UI class, kept as unknown here, just a pointer.
|
protected |
Token for modification registrations of UI Delegate.
|
protected |
Is the object value externally writable (over the net)