Data Store

The data store is reponsible for storing value for primitives, objects and references to callbacks and resources.

It holds all data the process needs to share:

  • Data maps in the store are scoped by key and value types.
  • Uses C++ templates and can hold any key or value type
  • Data Stores can be nested and accessed using a path (i.e.: /dataStoreParent/dataStoreChild)

These are types of data contained:

  • Resources, such as Output streams and the Actin Control System Executive Modifier
  • Data primitives (strings, bools, reals, integers)
  • Objects including state machines, control task identifiers

Source code: examples/dataAccessLayerExample

Access: Data can only be accessed using a Data Access Layer.

Nested: A Data Store can contain another Data Store at a hierarchical path similar to directories in a file system.

Paths: are used to uniquely identify elements in the data store. A path can be relative or absolute.

Configuration example Resulting data path
<dataStoreConfig path="a"> /a
<dataStoreConfig path = "b"> /a/b
<dataStoreConfig path = "/c"> /c
<dataStoreConfig path ="d"> /c/d

Relative paths are with respect to the current parent.

Data Store Configuration

The data store elements vector owned by EcDataStoreConfig can contain any type derived from EcBaseDataStoreElement. EcDataStoreConfig itself derives from EcBaseDataStoreElement which allows for creating hierarchies of data store elements

Data Store configuration occurs in two steps

  1. Initialize: all elements publish elements to the data store
  2. Configure: all elements subscribe to elements from the data store

Child classes of EcBaseDataStoreElement perform all initialization inside of initializeImpl () and configuration inside of configureImpl ().

Basic Data Map Elements

All basic types, vectors of basic types, enums and existing EcXmlObjects are supported and can be keys and values.

  • Common template implementation are provided by EcXmlDataMapElementType
  • Data is stored in non-XML types
  • Unique XML data map element tokens are generated using the type information and templated utility class EcDataTypeNameUtility

EcDataStoreConfig has a utility method for adding EcXmlDataMapElementType types by giving a key and a value.

See example: actin_ipc/examples/dataStoreConfigExample

Data Store Interface

headers:

    include /dataStoreInterface/

examples:

    examples/dataStoreConfigExample/
    examples/dataStoreAccessExample/

Example

This examples show how to add a basic type and vectors of basic type values, with different key types

  1. Create an EcDataStoreConfig to encapsulate a set of data elements
  2. Set the data store path for the elements
  3. Create some keys and values
  4. Add the keys and values to the data store config object.