Kanzi Connect  3.9.9
Kanzi Connect C++ API
kanzi::connect::RuntimeDataObjectList Class Reference

RuntimeDataObject list is used to hold list of information. More...

#include <runtimedataobjectlist.hpp>

Inheritance diagram for kanzi::connect::RuntimeDataObjectList:
kanzi::connect::RuntimeDataObject

Public Member Functions

virtual void appendItem (RuntimeDataObjectSharedPtr item)
 Adds an item to the end of the list. More...
 
virtual RuntimeDataObjectSharedPtr clone () override
 Clone the object as is. More...
 
virtual RuntimeDataObjectSharedPtr createItem ()
 Creates a new item based on stored item schema, or in case not present, from the first item stored currently in the list. More...
 
virtual RuntimeDataObjectSharedPtr createItemInplace ()
 Creates a list item and inserts it to the end of the list. More...
 
void disableModificationNotifications ()
 Disables modification notifications. More...
 
int enableModificationNotifications ()
 Enables modification notifications. More...
 
virtual bool equals (RuntimeDataObjectSharedPtr other) override
 Comparison. More...
 
virtual RuntimeDataObjectSharedPtr getItem (size_t index)
 Get item at specific position. More...
 
RuntimeDataObjectSharedPtr getTemplateItem () const
 Retrieve template item. More...
 
virtual Type getType () const override
 Retrieves the type of this data object. More...
 
shared_ptr< DataObject > getUITemplateItem () const
 Gets UI template item. More...
 
virtual void insertItem (RuntimeDataObjectSharedPtr item, size_t position)
 Inserts item into requested position. More...
 
virtual size_t itemCount ()
 return amount of items currently in list More...
 
virtual void removeAllChildren () override
 Remove all list items under this. More...
 
virtual void removeChild (const RuntimeDataObject &child) override
 Remove a list item under this. More...
 
virtual void removeChild (size_t index) override
 Remove a list item within this. More...
 
virtual void removeItem (size_t index)
 Release item at given position within the list. More...
 
virtual void removeListItems ()
 Remove all list items under this. More...
 
void resizeTo (size_t size)
 Resizes the list to specific size. More...
 
 RuntimeDataObjectList (ConnectDomainSharedPtr domain, const string &name, const string nameOverride="")
 Standard constructor. More...
 
 RuntimeDataObjectList (ConnectDomainSharedPtr domain, const string &path, const string &name, const string nameOverride)
 Standard constructor. More...
 
bool setSerializedJsonValues (const string &valueList)
 Set the list values from json data. More...
 
void setTemplateItem (RuntimeDataObjectSharedPtr tmpl)
 Save the template item used to factorize objects. More...
 
void setUITemplateItem (shared_ptr< DataObject > item)
 Sets UI template item. More...
 
- Public Member Functions inherited from kanzi::connect::RuntimeDataObject
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...
 
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 int flags, 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 int flags, 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...
 
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...
 
bool generatesGetter () const
 Retrieve getter generation status. 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...
 
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 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 (ConnectDomainSharedPtr domain, const string &name, const string nameOverride="")
 Standard constructor. More...
 
 RuntimeDataObject (ConnectDomainSharedPtr domain, const string &path, const string &name, const string nameOverride)
 Standard constructor. More...
 
bool sendsEvent () const
 Retrieve notifier event generation status. More...
 
void setGenerateGetter (bool creteGetter)
 Set generate getter flag. 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...
 
void setSendsEvent (bool createEventOnChange)
 Set generate notifier event flag. 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...
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::RuntimeDataObject
typedef ChildContainer::const_iterator ChildConstIterator
 
typedef ChildContainer::const_reverse_iterator ChildConstReverseIterator
 
typedef vector< RuntimeDataObjectSharedPtrChildContainer
 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...
 
- Static Public Member Functions inherited from kanzi::connect::RuntimeDataObject
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 inherited from kanzi::connect::RuntimeDataObject
typedef unordered_map< RuntimeDataObjectSharedPtr, ModifiedSubscriptionTokenChildrenSubscriptionContainer
 
enum  PrivateRuntimeFlags { NONE = 0x0, HAS_SETTER = 0x0001, HAS_NOTIFIER = 0x0010, HAS_GETTER = 0x0100 }
 
- Protected Attributes inherited from kanzi::connect::RuntimeDataObject
ChildContainer m_children
 Children of the data object. More...
 
ChildrenSubscriptionContainer m_childrenSubscriptionTokens
 
ConnectDomainSharedPtr m_domain
 The connect domain this dataobject is bound to. More...
 
int m_flags
 
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< unordered_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...
 

Detailed Description

RuntimeDataObject list is used to hold list of information.

Constructor & Destructor Documentation

◆ RuntimeDataObjectList() [1/2]

kanzi::connect::RuntimeDataObjectList::RuntimeDataObjectList ( ConnectDomainSharedPtr  domain,
const string &  name,
const string  nameOverride = "" 
)
inlineexplicit

Standard constructor.

Parameters
nameName of the data object.

◆ RuntimeDataObjectList() [2/2]

kanzi::connect::RuntimeDataObjectList::RuntimeDataObjectList ( ConnectDomainSharedPtr  domain,
const string &  path,
const string &  name,
const string  nameOverride 
)
inlineexplicit

Standard constructor.

Parameters
pathPath that contains names of the parents separated with '.'
nameName of the data object.

Member Function Documentation

◆ appendItem()

virtual void kanzi::connect::RuntimeDataObjectList::appendItem ( RuntimeDataObjectSharedPtr  item)
virtual

Adds an item to the end of the list.

Parameters
itemthe item to add

◆ clone()

virtual RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObjectList::clone ( )
inlineoverridevirtual

Clone the object as is.

Returns
exact clone of the object that was being called to.

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ createItem()

virtual RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObjectList::createItem ( )
virtual

Creates a new item based on stored item schema, or in case not present, from the first item stored currently in the list.

Returns
newly allocate item tree with default values.

◆ createItemInplace()

virtual RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObjectList::createItemInplace ( )
virtual

Creates a list item and inserts it to the end of the list.

Returns
newly allocated object.

◆ disableModificationNotifications()

void kanzi::connect::RuntimeDataObjectList::disableModificationNotifications ( )

Disables modification notifications.

◆ enableModificationNotifications()

int kanzi::connect::RuntimeDataObjectList::enableModificationNotifications ( )

Enables modification notifications.

Returns
the amount of modification requests received while those were disabled.

◆ equals()

virtual bool kanzi::connect::RuntimeDataObjectList::equals ( RuntimeDataObjectSharedPtr  other)
overridevirtual

Comparison.

Parameters
otherto be compared with
Returns
true if equals

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ getItem()

virtual RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObjectList::getItem ( size_t  index)
virtual

Get item at specific position.

Parameters
indexthe position of item
Returns
pointer to object

◆ getTemplateItem()

RuntimeDataObjectSharedPtr kanzi::connect::RuntimeDataObjectList::getTemplateItem ( ) const
inline

Retrieve template item.

Returns
the template item.

◆ getType()

virtual Type kanzi::connect::RuntimeDataObjectList::getType ( ) const
inlineoverridevirtual

Retrieves the type of this data object.

Returns
Type enumeration of this data object.

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ getUITemplateItem()

shared_ptr<DataObject> kanzi::connect::RuntimeDataObjectList::getUITemplateItem ( ) const
inline

Gets UI template item.

Returns
template item.

◆ insertItem()

virtual void kanzi::connect::RuntimeDataObjectList::insertItem ( RuntimeDataObjectSharedPtr  item,
size_t  position 
)
virtual

Inserts item into requested position.

If position is invalid then object is put to the end.

Parameters
positionposition where to put the item into.

◆ itemCount()

virtual size_t kanzi::connect::RuntimeDataObjectList::itemCount ( )
virtual

return amount of items currently in list

Returns
amount of elements.

◆ removeAllChildren()

virtual void kanzi::connect::RuntimeDataObjectList::removeAllChildren ( )
overridevirtual

Remove all list items under this.

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ removeChild() [1/2]

virtual void kanzi::connect::RuntimeDataObjectList::removeChild ( const RuntimeDataObject child)
overridevirtual

Remove a list item under this.

Parameters
childThe item to remove

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ removeChild() [2/2]

virtual void kanzi::connect::RuntimeDataObjectList::removeChild ( size_t  index)
overridevirtual

Remove a list item within this.

Parameters
indexIdentifies the item to remove

Reimplemented from kanzi::connect::RuntimeDataObject.

◆ removeItem()

virtual void kanzi::connect::RuntimeDataObjectList::removeItem ( size_t  index)
virtual

Release item at given position within the list.

Parameters
indexitem position.

◆ removeListItems()

virtual void kanzi::connect::RuntimeDataObjectList::removeListItems ( )
virtual

Remove all list items under this.

◆ resizeTo()

void kanzi::connect::RuntimeDataObjectList::resizeTo ( size_t  size)

Resizes the list to specific size.

Parameters
sizethe new size for list.

◆ setSerializedJsonValues()

bool kanzi::connect::RuntimeDataObjectList::setSerializedJsonValues ( const string &  valueList)

Set the list values from json data.

Parameters
valueListContains the values to set in json format

◆ setTemplateItem()

void kanzi::connect::RuntimeDataObjectList::setTemplateItem ( RuntimeDataObjectSharedPtr  tmpl)
inline

Save the template item used to factorize objects.

Parameters
tmpltemplate object

◆ setUITemplateItem()

void kanzi::connect::RuntimeDataObjectList::setUITemplateItem ( shared_ptr< DataObject >  item)
inline

Sets UI template item.

Parameters
itemthe template item

The documentation for this class was generated from the following file: