Abstract base class for all data-model implementations.
#include <DataModelImpl.h>
Public Member Functions | |
virtual void | addExtension (DataModelExtension *ext) |
Register an extension to get data into and out of the data-model. More... | |
virtual void | assign (const std::string &location, const Data &data, const std::map< std::string, std::string > &attr=std::map< std::string, std::string >())=0 |
Assign a data object to a location in the data-model. More... | |
virtual std::shared_ptr< DataModelImpl > | create (DataModelCallbacks *callbacks)=0 |
The Factory wants to instantiate a new instance. More... | |
virtual bool | evalAsBool (const std::string &expr)=0 |
Evaluate a given expression as a boolean. More... | |
virtual Data | evalAsData (const std::string &content)=0 |
Return a string as an evaluated Data object. More... | |
virtual Data | getAsData (const std::string &content)=0 |
Return a string as an unevaluated Data object. More... | |
virtual uint32_t | getLength (const std::string &expr)=0 |
Evaluate the given expression as something iterable and return its length. More... | |
virtual std::list< std::string > | getNames ()=0 |
Return a list of names to be matched by the datamodel attribute in SCXML. | |
virtual void | init (const std::string &location, const Data &data, const std::map< std::string, std::string > &attr=std::map< std::string, std::string >())=0 |
Initialize a variable / location in the data-model with a given data object. More... | |
virtual bool | isDeclared (const std::string &expr)=0 |
Determine whether a given variable / location is declared. More... | |
virtual bool | isValidSyntax (const std::string &expr) |
Determine whether a given string constitutes valid syntax in the data-model's language. More... | |
size_t | replaceExpressions (std::string &content) |
Experimental extension to have dynamic content in string literals. More... | |
virtual void | setEvent (const Event &event)=0 |
Set the given event as _event in the data-model's global scope. More... | |
virtual void | setForeach (const std::string &item, const std::string &array, const std::string &index, uint32_t iteration)=0 |
Set a given item to the object at a given index for one iteration. More... | |
Protected Attributes | |
DataModelCallbacks * | _callbacks |
Member Function Documentation
|
virtual |
- Todo:
- This is currently unsupported
Reimplemented in uscxml::NullDataModel, uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
There are different occurences in the SCXML IRP tests, e.g.
test147: <data id="Var1" expr="0"/> test150: <data id="Var3"> [1,2,3] </data> test277: <data id="Var1" expr="return"/>
- Parameters
-
location A variable or locatio to assign to. data The Data object with the respective data. attr Additional attributes of the XML assign element.
Implemented in uscxml::NullDataModel, uscxml::JSCDataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
This function will have to initialize the object. The actual constructor is called from within here. The only one who calls the constructor directly is the Factory for the prototype object.
- Parameters
-
callbacks The callbacks available to the datamodel
- Returns
- A shared pointer with an initialized instance
Implemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, uscxml::NullDataModel, and uscxml::PromelaDataModel.
|
pure virtual |
This function is a subset of evalAsData() but saves on creating and copying a Data object.
- Parameters
-
expr An expression in the data-model's language.
- Returns
- Whether the expression evaluates as
true
Implemented in uscxml::NullDataModel, uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
- Parameters
-
content A string with a literal, eppression or compound data-structure in the data-model's language.
- Returns
- An evaluated structure representing the given compound or literal.
Implemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::NullDataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
- Parameters
-
content A string with a literal, eppression or compound data-structure in the data-model's language.
- Returns
- An unevaluated structure representing the given compound or literal.
Implemented in uscxml::C89DataModel, uscxml::JSCDataModel, uscxml::LuaDataModel, uscxml::NullDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
- Parameters
-
expr Anything that possibly evaluates to an enumerable object.
- Returns
- The number of items in the enumerable object.
Implemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::NullDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
This is, semantically, very close to assign() but does not assume the location to be declared first.
- Parameters
-
location A variable or locatio to assign to. data The Data object with the respective data. attr Additional attributes of the XML data element.
Implemented in uscxml::NullDataModel, uscxml::JSCDataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
pure virtual |
- Parameters
-
expr The variable / location to check.
- Todo:
- Is this still used?
Implemented in uscxml::NullDataModel, uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
|
inlinevirtual |
- Parameters
-
expr A string, supposedly containing an expression of the data-model.
- Returns
- Whether expr is in L(DM).
Reimplemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, uscxml::NullDataModel, and uscxml::PromelaDataModel.
size_t uscxml::DataModelImpl::replaceExpressions | ( | std::string & | content | ) |
This function was used to replace ${foo} expressions on the data-model, e.g. in text nodes. It will eventually make a reappearance I guess.
- Parameters
-
content The string with tokens to replace.
- Returns
- How many occurences where replaced.
|
pure virtual |
- Parameters
-
event The event as it was dequeued from either the internal or external queue.
Implemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::V8DataModel, uscxml::NullDataModel, and uscxml::PromelaDataModel.
|
pure virtual |
- Parameters
-
item A variable or location to assign the current object to. array An expression evalating to an enumerable object. index A variable or location to set the current index at. iteration The current iteration index.
Implemented in uscxml::JSCDataModel, uscxml::C89DataModel, uscxml::LuaDataModel, uscxml::NullDataModel, uscxml::V8DataModel, and uscxml::PromelaDataModel.
The documentation for this class was generated from the following files:
- plugins/DataModelImpl.h
- plugins/Factory.cpp