Kanzi  3.9.4
Kanzi Engine API
kanzi::ActivityElementHistory Class Reference

Encapsulates serialized data for activity elements. More...

#include <kanzi/ui/node/concept/activity/activity_element_history.hpp>

Classes

struct  SerializedActivityProperty
 Encapsulates the serialized data for a property. More...
 

Public Types

typedef vector< SerializedActivityPropertySerializedActivityPropertyContainer
 Container of serialized of properties. More...
 

Public Member Functions

 ActivityElementHistory (string activityElementHistoryData)
 Constructor. More...
 
 ActivityElementHistory (Node &node, const vector< string > &childrenHistory)
 Constructor. More...
 
 ActivityElementHistory (string_view name, const SerializedActivityPropertyContainer &properties, const vector< string > &childrenHistory)
 Constructor. More...
 
const vector< string > & getChildrenHistory () const
 Accesses the serialized children. More...
 
const string & getName () const
 Accesses the name of the element. More...
 
const SerializedActivityPropertyContainergetProperties () const
 Accesses the serialized properties. More...
 
bool invalidate (string_view activityPath)
 Invalidates the history for the ActivityElement with the given relative path. More...
 
bool invalidateProperties (string_view activityPath, const vector< AbstractPropertyType > &invalidProperties)
 Invalidates the serialized property values for an ActivityElement with the given relative path. More...
 
string serialize () const
 Serializes the history to a byte buffer. More...
 

Static Public Member Functions

static void deserializeActivityProperty (Node &node, const SerializedActivityProperty &property)
 Deserializes an activity property. More...
 
static string_view extractNameFromSerializedString (const string_view data)
 Retruns the name of an Activity element from the data. More...
 
static bool extractVariantFromSerializedPropertyString (string_view value, PropertyDataType dataType, Variant &variant)
 Extracts property data from a serialized string into a Variant type. More...
 
static optional< string > findPropertyValue (string_view propertyName, string_view serializedActivityElement)
 Returns a value for a property in the serialized history of an ActivityElement. More...
 
static vector< SerializedActivityPropertygetSerializedProperties (Node &node)
 Returns the properties and property values that an Activity serialized. More...
 
static bool isActivityProperty (const AbstractPropertyType &property, string_view activityName)
 Returns whether a property belongs to an Activity node, or not. More...
 
static bool isPropertySkippedForUpdate (string_view name)
 Checks if property given with name does not trigger the update of Activity Browser Properties. More...
 
static string serializeActivityProperty (const AbstractPropertyType &property, string_view value)
 Serializes a single Activity property to a string. More...
 

Static Public Attributes

static constexpr const char * s_activityPropertyNamespace
 The namespace to which an Activity Property must belong. More...
 

Detailed Description

Encapsulates serialized data for activity elements.

This is a helper class for activities and activity hosts.

Member Typedef Documentation

◆ SerializedActivityPropertyContainer

Constructor & Destructor Documentation

◆ ActivityElementHistory() [1/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( string  activityElementHistoryData)
explicit

Constructor.

Constructs the history of a node and its child nodes from serialized data.

Parameters
activityElementHistoryDataSerialized data.

◆ ActivityElementHistory() [2/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( Node node,
const vector< string > &  childrenHistory 
)
explicit

Constructor.

Constructs the history for a node and uses serialized data for its children.

Parameters
nodeThe node to extract history from.
childrenHistoryThe serialized history of the activity element's children.

◆ ActivityElementHistory() [3/3]

kanzi::ActivityElementHistory::ActivityElementHistory ( string_view  name,
const SerializedActivityPropertyContainer properties,
const vector< string > &  childrenHistory 
)
explicit

Constructor.

Constructs the history from a nodes name, its properties and serialized history of its children.

Parameters
nameThe name of the activity element.
propertiesThe properties of the activity element.
childrenHistoryThe serialized history of the activity element's children.

Member Function Documentation

◆ serialize()

string kanzi::ActivityElementHistory::serialize ( ) const

Serializes the history to a byte buffer.

Returns
The byte buffer with serialized data.

◆ invalidate()

bool kanzi::ActivityElementHistory::invalidate ( string_view  activityPath)

Invalidates the history for the ActivityElement with the given relative path.

Parameters
activityPathThe relative path of the ActivityElement for which to invalidate the history.
Returns
If the history of this element was modified, returns true, otherwise false.
Since
Kanzi 3.9.3

◆ invalidateProperties()

bool kanzi::ActivityElementHistory::invalidateProperties ( string_view  activityPath,
const vector< AbstractPropertyType > &  invalidProperties 
)

Invalidates the serialized property values for an ActivityElement with the given relative path.

Parameters
activityPathThe relative path of the ActivityElement for which to invalidate the properties.
invalidPropertiesThe list of property types to invalidate.
Returns
If the history of this element was modified, returns true, otherwise false.
Since
Kanzi 3.9.3

◆ isActivityProperty()

static bool kanzi::ActivityElementHistory::isActivityProperty ( const AbstractPropertyType property,
string_view  activityName 
)
static

Returns whether a property belongs to an Activity node, or not.

A property belongs to an Activity node if:

  • It is defined in any of the Kanzi Activity classes.
  • Or, it belongs to the s_activityPropertyNamespace namespace.
  • Or, the name of the property belongs to the namespace of a given Activity node object.
  • And, it is serializable.
    Parameters
    propertyThe property to check.
    activityNameThe name of an Activity node.
    Returns
    true if the property belongs to the given Activity node, otherwise false.

◆ getSerializedProperties()

static vector<SerializedActivityProperty> kanzi::ActivityElementHistory::getSerializedProperties ( Node node)
static

Returns the properties and property values that an Activity serialized.

Parameters
nodeThe activity node to serialize.
Returns
Serialized activity properties.

◆ serializeActivityProperty()

static string kanzi::ActivityElementHistory::serializeActivityProperty ( const AbstractPropertyType property,
string_view  value 
)
static

Serializes a single Activity property to a string.

This serialized string is included in the serialized history of the ActivityElement.

Parameters
propertyThe property to serialize.
valueThe value of property to serialize.
Returns
A string containing the serialized Activity property.
Since
Kanzi 3.9.0

◆ deserializeActivityProperty()

static void kanzi::ActivityElementHistory::deserializeActivityProperty ( Node node,
const SerializedActivityProperty property 
)
static

Deserializes an activity property.

Parameters
nodeThe activity node.
propertyThe serialized property.

◆ getProperties()

const SerializedActivityPropertyContainer& kanzi::ActivityElementHistory::getProperties ( ) const

Accesses the serialized properties.

Returns
The serialized properties.

◆ getChildrenHistory()

const vector<string>& kanzi::ActivityElementHistory::getChildrenHistory ( ) const

Accesses the serialized children.

Returns
The serialized children.

◆ getName()

const string& kanzi::ActivityElementHistory::getName ( ) const

Accesses the name of the element.

Returns
The name of the element.

◆ findPropertyValue()

static optional<string> kanzi::ActivityElementHistory::findPropertyValue ( string_view  propertyName,
string_view  serializedActivityElement 
)
static

Returns a value for a property in the serialized history of an ActivityElement.

Parameters
propertyNameThe name of the property for which you requested the value.
serializedActivityElementString representation of a serialized ActivityElement.
Returns
If the property is in the serialized ActivityElement, value as a string of the requested property, otherwise nullopt.
Since
Kanzi 3.9.0

◆ extractVariantFromSerializedPropertyString()

static bool kanzi::ActivityElementHistory::extractVariantFromSerializedPropertyString ( string_view  value,
PropertyDataType  dataType,
Variant variant 
)
static

Extracts property data from a serialized string into a Variant type.

Parameters
valueThe serialized property data string.
dataTypeThe data type of the property to extract.
variantA reference to the extracted Variant.
Returns
If the function successfully parses the value, true, otherwise false.
Since
Kanzi 3.9.0

◆ extractNameFromSerializedString()

static string_view kanzi::ActivityElementHistory::extractNameFromSerializedString ( const string_view  data)
static

Retruns the name of an Activity element from the data.

This function does not modify the buffer.

Parameters
dataThe serialized data from which to get the name of an Activity element.
Returns
The serialized name of an Activity element.
Since
Kanzi 3.9.4

◆ isPropertySkippedForUpdate()

static bool kanzi::ActivityElementHistory::isPropertySkippedForUpdate ( string_view  name)
static

Checks if property given with name does not trigger the update of Activity Browser Properties.

Parameters
nameThe property name to check.
Returns
true if the property is not supposed to trigger the update of Activity Browser Properties, false otherwise.

Member Data Documentation

◆ s_activityPropertyNamespace

constexpr const char* kanzi::ActivityElementHistory::s_activityPropertyNamespace
static

The namespace to which an Activity Property must belong.

Since
Kanzi 3.9.0

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