diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-05-19 08:03:50 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-05-19 08:03:50 (GMT) |
commit | 5de792adc6796b0f03d62124765b4af0676dde46 (patch) | |
tree | e700d6b008b21c037aebcc1882fd9286920b2987 /src/uscxml/plugins | |
parent | f8e0c96fddfdd5f086e1bd973d6b0a19c39c93da (diff) | |
download | uscxml-5de792adc6796b0f03d62124765b4af0676dde46.zip uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.gz uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.bz2 |
Refactored for public headers and started documentation
Diffstat (limited to 'src/uscxml/plugins')
26 files changed, 848 insertions, 350 deletions
diff --git a/src/uscxml/plugins/DataModel.cpp b/src/uscxml/plugins/DataModel.cpp new file mode 100644 index 0000000..96afd89 --- /dev/null +++ b/src/uscxml/plugins/DataModel.cpp @@ -0,0 +1,86 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#include "DataModel.h" +#include "DataModelImpl.h" + +namespace uscxml { + +std::list<std::string> DataModel::getNames() { + return _impl->getNames(); +} + +bool DataModel::isValidSyntax(const std::string& expr) { + return _impl->isValidSyntax(expr); +} + +void DataModel::setEvent(const Event& event) { + return _impl->setEvent(event); +} + +Data DataModel::getAsData(const std::string& content) { + return _impl->getAsData(content); +} + +Data DataModel::evalAsData(const std::string& content) { + return _impl->evalAsData(content); +} + +bool DataModel::evalAsBool(const std::string& expr) { + return _impl->evalAsBool(expr); +} + +uint32_t DataModel::getLength(const std::string& expr) { + return _impl->getLength(expr); +} + +void DataModel::setForeach(const std::string& item, + const std::string& array, + const std::string& index, + uint32_t iteration) { + return _impl->setForeach(item, array, index, iteration); +} + +void DataModel::assign(const std::string& location, const Data& data) { + return _impl->assign(location, data); +} + +void DataModel::init(const std::string& location, const Data& data) { + return _impl->init(location, data); +} + +bool DataModel::isDeclared(const std::string& expr) { + return _impl->isDeclared(expr); +} + +size_t DataModel::replaceExpressions(std::string& content) { + return _impl->replaceExpressions(content); +} + +std::string DataModel::andExpressions(std::list<std::string> expressions) { + return _impl->andExpressions(expressions); +} + +void DataModel::addExtension(DataModelExtension* ext) { + return _impl->addExtension(ext); +} + + +} + diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h index b08f934..03e557c 100644 --- a/src/uscxml/plugins/DataModel.h +++ b/src/uscxml/plugins/DataModel.h @@ -21,208 +21,65 @@ #define DATAMODEL_H_F1F776F9 #include "uscxml/Common.h" -#include "uscxml/plugins/Invoker.h" -#include "uscxml/plugins/IOProcessor.h" - -#ifndef TIME_BLOCK -# ifdef BUILD_PROFILING -# include "uscxml/concurrency/Timer.h" -# define TIME_BLOCK Measurement msm(&timer); -# else -# define TIME_BLOCK -# endif -#endif +#include "uscxml/messages/Event.h" #include <list> #include <string> #include <memory> -#include <sstream> - -#include <xercesc/dom/DOM.hpp> namespace uscxml { -class InterpreterImpl; class DataModelImpl; +class DataModelExtension; -class USCXML_API DataModelCallbacks { +/** + * @ingroup datamodel + * @ingroup facade + * The facade for data-models. + */ +class USCXML_API DataModel { public: - virtual const std::string& getName() = 0; - virtual const std::string& getSessionId() = 0; - virtual const std::map<std::string, IOProcessor>& getIOProcessors() = 0; - virtual bool isInState(const std::string& stateId) = 0; - virtual xercesc::DOMDocument* getDocument() const = 0; - virtual const std::map<std::string, Invoker>& getInvokers() = 0; -}; -class USCXML_API DataModelExtension { -public: - DataModelExtension() : dm(NULL) {} - virtual ~DataModelExtension() {} - virtual std::string provides() = 0; - virtual Data getValueOf(const std::string& member) = 0; - virtual void setValueOf(const std::string& member, const Data& data) = 0; - DataModelImpl* dm; -}; + PIMPL_OPERATORS(DataModel); -class USCXML_API DataModelImpl { -public: - virtual ~DataModelImpl() {} - virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* interpreter) = 0; - virtual std::list<std::string> getNames() = 0; + /// @copydoc DataModelImpl::getNames() + virtual std::list<std::string> getNames(); + /// @copydoc DataModelImpl::isValidSyntax() + virtual bool isValidSyntax(const std::string& expr); - virtual bool isValidSyntax(const std::string& expr) { - return true; // overwrite when datamodel supports it - } - virtual void setEvent(const Event& event) = 0; + /// @copydoc DataModelImpl::setEvent() + virtual void setEvent(const Event& event); - size_t replaceExpressions(std::string& content); + /// @copydoc DataModelImpl::getAsData() + virtual Data getAsData(const std::string& content); + /// @copydoc DataModelImpl::evalAsData() + virtual Data evalAsData(const std::string& content); + /// @copydoc DataModelImpl::evalAsBool() + virtual bool evalAsBool(const std::string& expr); - // foreach - virtual uint32_t getLength(const std::string& expr) = 0; + /// @copydoc DataModelImpl::getLength() + virtual uint32_t getLength(const std::string& expr); + /// @copydoc DataModelImpl::setForeach() virtual void setForeach(const std::string& item, const std::string& array, const std::string& index, - uint32_t iteration) = 0; - - virtual Data getAsData(const std::string& content) = 0; - virtual Data evalAsData(const std::string& content) = 0; - virtual bool evalAsBool(const std::string& expr) = 0; - - virtual bool isDeclared(const std::string& expr) = 0; - - /** - * test147: - * <data id="Var1" expr="0"/> - * - * test150: - * <data id="Var3"> - * [1,2,3] - * </data> - * - * test277: - * <data id="Var1" expr="return"/> - * - */ - virtual void assign(const std::string& location, const Data& data) = 0; - virtual void init(const std::string& location, const Data& data) = 0; - - virtual void setCallbacks(DataModelCallbacks* callbacks) { - _callbacks = callbacks; - } + uint32_t iteration); - virtual void addExtension(DataModelExtension* ext); - virtual std::string andExpressions(std::list<std::string>) { - return ""; - } + /// @copydoc DataModelImpl::assign() + virtual void assign(const std::string& location, const Data& data); + /// @copydoc DataModelImpl::init() + virtual void init(const std::string& location, const Data& data); -protected: - DataModelCallbacks* _callbacks; -}; + /// @copydoc DataModelImpl::isDeclared() + virtual bool isDeclared(const std::string& expr); -class USCXML_API DataModel { -public: + /// @copydoc DataModelImpl::replaceExpressions() + size_t replaceExpressions(std::string& content); + /// @copydoc DataModelImpl::andExpressions() + std::string andExpressions(std::list<std::string> expressions); - DataModel() : _impl() {} - DataModel(const std::shared_ptr<DataModelImpl> impl) : _impl(impl) { } - DataModel(const DataModel& other) : _impl(other._impl) { } - virtual ~DataModel() {}; - - operator bool() const { - return !!_impl; - } - bool operator< (const DataModel& other) const { - return _impl < other._impl; - } - bool operator==(const DataModel& other) const { - return _impl == other._impl; - } - bool operator!=(const DataModel& other) const { - return _impl != other._impl; - } - DataModel& operator= (const DataModel& other) { - _impl = other._impl; - return *this; - } - - virtual std::list<std::string> getNames() { - TIME_BLOCK - return _impl->getNames(); - } - - virtual bool isValidSyntax(const std::string& expr) { - TIME_BLOCK - return _impl->isValidSyntax(expr); - } - - virtual void setEvent(const Event& event) { - TIME_BLOCK - return _impl->setEvent(event); - } - virtual Data getAsData(const std::string& content) { - TIME_BLOCK - return _impl->getAsData(content); - } - virtual Data evalAsData(const std::string& content) { - TIME_BLOCK - return _impl->evalAsData(content); - } - - virtual bool evalAsBool(const std::string& expr) { - TIME_BLOCK - return _impl->evalAsBool(expr); - } - - virtual uint32_t getLength(const std::string& expr) { - TIME_BLOCK - return _impl->getLength(expr); - } - virtual void setForeach(const std::string& item, - const std::string& array, - const std::string& index, - uint32_t iteration) { - TIME_BLOCK - return _impl->setForeach(item, array, index, iteration); - } - - virtual void assign(const std::string& location, const Data& data) { - TIME_BLOCK - return _impl->assign(location, data); - } - - virtual void init(const std::string& location, const Data& data) { - TIME_BLOCK - return _impl->init(location, data); - } - - virtual bool isDeclared(const std::string& expr) { - TIME_BLOCK - return _impl->isDeclared(expr); - } - - size_t replaceExpressions(std::string& content) { - TIME_BLOCK - return _impl->replaceExpressions(content); - } - - std::string andExpressions(std::list<std::string> expressions) { - TIME_BLOCK - return _impl->andExpressions(expressions); - } - - virtual void setCallbacks(DataModelCallbacks* callbacks) { - TIME_BLOCK - _impl->setCallbacks(callbacks); - } - - virtual void addExtension(DataModelExtension* ext) { - TIME_BLOCK - _impl->addExtension(ext); - } - -#ifdef BUILD_PROFILING - Timer timer; -#endif + /// @copydoc DataModelImpl::addExtension() + virtual void addExtension(DataModelExtension* ext); protected: std::shared_ptr<DataModelImpl> _impl; diff --git a/src/uscxml/plugins/DataModelImpl.h b/src/uscxml/plugins/DataModelImpl.h new file mode 100644 index 0000000..e2795c0 --- /dev/null +++ b/src/uscxml/plugins/DataModelImpl.h @@ -0,0 +1,196 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#ifndef DATAMODELIMPL_H_5A33C087 +#define DATAMODELIMPL_H_5A33C087 + +#include "uscxml/config.h" +#include "uscxml/Common.h" +#include "uscxml/plugins/Invoker.h" +#include "uscxml/plugins/IOProcessor.h" + +#include <xercesc/dom/DOM.hpp> + +#include <list> +#include <string> +#include <memory> + +namespace uscxml { + +class InterpreterImpl; +class DataModelImpl; + +/** + * @ingroup datamodel + * @ingroup callback + * Callbacks available for every data-model. + */ +class USCXML_API DataModelCallbacks { +public: + virtual const std::string& getName() = 0; + virtual const std::string& getSessionId() = 0; + virtual const std::map<std::string, IOProcessor>& getIOProcessors() = 0; + virtual bool isInState(const std::string& stateId) = 0; + virtual XERCESC_NS::DOMDocument* getDocument() const = 0; + virtual const std::map<std::string, Invoker>& getInvokers() = 0; +}; + +class USCXML_API DataModelExtension { +public: + DataModelExtension() : dm(NULL) {} + virtual ~DataModelExtension() {} + virtual std::string provides() = 0; + virtual Data getValueOf(const std::string& member) = 0; + virtual void setValueOf(const std::string& member, const Data& data) = 0; + DataModelImpl* dm; +}; + +/** + * @ingroup datamodel + * @ingroup abstract + * Abstract base class for all data-model implementations. + */ +class USCXML_API DataModelImpl { +public: + virtual ~DataModelImpl() {} + + /** + * The Factory wants to instantiate a new instance. + * 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. + * + * @param callbacks The callbacks available to the datamodel + * @return A shared pointer with an initialized instance + */ + virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks) = 0; + + /** + * Return a list of names to be matched by the `datamodel` attribute in SCXML. + */ + virtual std::list<std::string> getNames() = 0; + + /** + * Determine whether a given string constitutes valid syntax in the + * data-model's language. + * @param expr A string, supposedly containing an expression of the data-model. + * @return Whether expr is in L(DM). + */ + virtual bool isValidSyntax(const std::string& expr) { + return true; // overwrite when datamodel supports it + } + + /** + * Set the given event as `_event` in the data-model's global scope. + * @param event The event as it was dequeued from either the internal or external queue. + */ + virtual void setEvent(const Event& event) = 0; + + /** + * Experimental extension to have dynamic content in string literals. + * 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. + * @param content The string with tokens to replace. + * @return How many occurences where replaced. + */ + size_t replaceExpressions(std::string& content); + + ///@name Foreach Support + ///@{ + + // foreach + virtual uint32_t getLength(const std::string& expr) = 0; + virtual void setForeach(const std::string& item, + const std::string& array, + const std::string& index, + uint32_t iteration) = 0; + ///@} + + /** + * Return a string as an *unevaluated* Data object. + * @param content A string with a literal, eppression or compound data-structure in the data-model's language. + * @return An unevaluated structure representing the given compound or literal. + */ + virtual Data getAsData(const std::string& content) = 0; + + /** + * Return a string as an *evaluated* Data object. + * @param content A string with a literal, eppression or compound data-structure in the data-model's language. + * @return An evaluated structure representing the given compound or literal. + */ + virtual Data evalAsData(const std::string& content) = 0; + + /** + * Evaluate a given expression as a boolean. + * This function is a subset of evalAsData() but saves on creating and copying a Data object. + * @param expr An expression in the data-model's language. + * @return Whether the expression evaluates as `true` + */ + virtual bool evalAsBool(const std::string& expr) = 0; + + /** + * Determine whether a given variable / location is declared. + * @param expr The variable / location to check. + * @todo Is this still used? + */ + virtual bool isDeclared(const std::string& expr) = 0; + + /** + * Assign a data object to a location in the data-model. + * There are different occurences in the SCXML IRP tests, e.g. +\verbatim +test147: + <data id="Var1" expr="0"/> + +test150: + <data id="Var3"> + [1,2,3] + </data> + +test277: + <data id="Var1" expr="return"/> +\endverbatim + * @param location A variable or locatio to assign to. + * @param data The Data object with the respective data. + */ + virtual void assign(const std::string& location, const Data& data) = 0; + + /** + * Initialize a variable / location in the data-model with a given data object. + * This is, semantically, very close to assign() but does not assume the + * location to be declared first. + * + * @param location A variable or locatio to assign to. + * @param data The Data object with the respective data. + */ + virtual void init(const std::string& location, const Data& data) = 0; + + + virtual void addExtension(DataModelExtension* ext); + virtual std::string andExpressions(std::list<std::string>) { + return ""; + } + +protected: + DataModelCallbacks* _callbacks; +}; + +} + +#endif /* end of include guard: DATAMODELIMPL_H_5A33C087 */ diff --git a/src/uscxml/plugins/EventHandler.h b/src/uscxml/plugins/EventHandler.h index 401afec..e08b1ad 100644 --- a/src/uscxml/plugins/EventHandler.h +++ b/src/uscxml/plugins/EventHandler.h @@ -21,40 +21,58 @@ #define EVENTHANDLER_H_2801243E #include "uscxml/Common.h" -#include "uscxml/messages/Data.h" #include "uscxml/messages/Event.h" #include <list> #include <string> #include <memory> -#include <sstream> - -#include <xercesc/dom/DOM.hpp> namespace uscxml { class InterpreterImpl; +/** + * @ingroup ioproc + * @ingroup invoker + * @ingroup impl + * Common base class for invokers and i/o processors. + */ + class USCXML_API EventHandlerImpl { public: EventHandlerImpl() {} virtual ~EventHandlerImpl() {} + /** + * Return a list of names for types we implement. + */ virtual std::list<std::string> getNames() = 0; + + /** + * Export a Data object for the `_x['name']` data-model namespace + * @return An object to be represented at `_x['name']` + */ virtual Data getDataModelVariables() = 0; protected: InterpreterImpl* _interpreter; }; +/** + * @ingroup ioproc + * @ingroup invoker + * @ingroup facade + */ class USCXML_API EventHandler { public: PIMPL_OPERATORS(EventHandler); + /// @copydoc EventHandlerImpl::getNames virtual std::list<std::string> getNames() { return _impl->getNames(); } + /// @copydoc EventHandlerImpl::getDataModelVariables virtual Data getDataModelVariables() const { return _impl->getDataModelVariables(); }; diff --git a/src/uscxml/plugins/ExecutableContent.cpp b/src/uscxml/plugins/ExecutableContent.cpp new file mode 100644 index 0000000..349f239 --- /dev/null +++ b/src/uscxml/plugins/ExecutableContent.cpp @@ -0,0 +1,50 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#include "ExecutableContent.h" +#include "ExecutableContentImpl.h" + +#include <xercesc/dom/DOM.hpp> +#include <string> +#include <memory> +#include <sstream> + +namespace uscxml { + +std::string ExecutableContent::getLocalName() { + return _impl->getLocalName(); +} + +std::string ExecutableContent::getNamespace() { + return _impl->getNamespace(); +} + +void ExecutableContent::enterElement(XERCESC_NS::DOMElement* node) { + return _impl->enterElement(node); +} + +void ExecutableContent::exitElement(XERCESC_NS::DOMElement* node) { + return _impl->exitElement(node); +} + +bool ExecutableContent::processChildren() { + return _impl->processChildren(); +} + +} diff --git a/src/uscxml/plugins/ExecutableContent.h b/src/uscxml/plugins/ExecutableContent.h index 0190820..14c1d5d 100644 --- a/src/uscxml/plugins/ExecutableContent.h +++ b/src/uscxml/plugins/ExecutableContent.h @@ -20,81 +20,37 @@ #ifndef EXECUTABLECONTENT_H_1E028A2D #define EXECUTABLECONTENT_H_1E028A2D +#include "uscxml/config.h" #include "uscxml/Common.h" + #include <string> #include <memory> #include <sstream> -#include "xercesc/dom/DOM.hpp" - -namespace uscxml { - -class InterpreterImpl; -class USCXML_API ExecutableContentImpl { -public: - ExecutableContentImpl() {}; - virtual ~ExecutableContentImpl() {}; - virtual std::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) = 0; +// forward declare +namespace XERCESC_NS { + class DOMElement; +} - virtual void setInterpreter(InterpreterImpl* interpreter) { - _interpreter = interpreter; - } +namespace uscxml { - virtual std::string getLocalName() = 0; ///< The name of the element. - virtual std::string getNamespace() { - return "http://www.w3.org/2005/07/scxml"; ///< The namespace of the element. - } - virtual void enterElement(xercesc::DOMElement* node) = 0; ///< Invoked when entering the element as part of evaluating executable content. - virtual void exitElement(xercesc::DOMElement* node) = 0; ///< Invoked when exiting the element as part of evaluating executable content. - virtual bool processChildren() = 0; ///< Whether or not the interpreter should process this elements children. - -protected: - InterpreterImpl* _interpreter; -}; +class ExecutableContentImpl; +/** + * @ingroup element + * @ingroup facade + * Facade for all executable content implementations. + */ class USCXML_API ExecutableContent { public: - ExecutableContent() : _impl() {} - ExecutableContent(std::shared_ptr<ExecutableContentImpl> const impl) : _impl(impl) { } - ExecutableContent(const ExecutableContent& other) : _impl(other._impl) { } - virtual ~ExecutableContent() {}; - - operator bool() const { - return !!_impl; - } - bool operator< (const ExecutableContent& other) const { - return _impl < other._impl; - } - bool operator==(const ExecutableContent& other) const { - return _impl == other._impl; - } - bool operator!=(const ExecutableContent& other) const { - return _impl != other._impl; - } - ExecutableContent& operator= (const ExecutableContent& other) { - _impl = other._impl; - return *this; - } - - void setInterpreter(InterpreterImpl* interpreter) { - _impl->setInterpreter(interpreter); - } - - std::string getLocalName() { - return _impl->getLocalName(); - } - std::string getNamespace() { - return _impl->getNamespace(); - } - void enterElement(xercesc::DOMElement* node) { - return _impl->enterElement(node); - } - void exitElement(xercesc::DOMElement* node) { - return _impl->exitElement(node); - } - bool processChildren() { - return _impl->processChildren(); - } + PIMPL_OPERATORS(ExecutableContent); + + std::string getLocalName(); + std::string getNamespace(); + void enterElement(XERCESC_NS::DOMElement* node); + void exitElement(XERCESC_NS::DOMElement* node); + bool processChildren(); + protected: std::shared_ptr<ExecutableContentImpl> _impl; diff --git a/src/uscxml/plugins/ExecutableContentImpl.h b/src/uscxml/plugins/ExecutableContentImpl.h new file mode 100644 index 0000000..d033d1e --- /dev/null +++ b/src/uscxml/plugins/ExecutableContentImpl.h @@ -0,0 +1,65 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#ifndef EXECUTABLECONTENTIMPL_H_CCE9F02D +#define EXECUTABLECONTENTIMPL_H_CCE9F02D + +#include "uscxml/config.h" +#include "uscxml/Common.h" + +#include <xercesc/dom/DOM.hpp> +#include <string> +#include <memory> +#include <sstream> + +namespace uscxml { + +class InterpreterImpl; + +/** + * @ingroup element + * @ingroup impl + * Abstract base class fo all elements of executable content. + */ +class USCXML_API ExecutableContentImpl { +public: + ExecutableContentImpl() {}; + virtual ~ExecutableContentImpl() {}; + virtual std::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) = 0; + + virtual void setInterpreter(InterpreterImpl* interpreter) { + _interpreter = interpreter; + } + + virtual std::string getLocalName() = 0; ///< The name of the element. + virtual std::string getNamespace() { + return "http://www.w3.org/2005/07/scxml"; ///< The namespace of the element. + } + virtual void enterElement(XERCESC_NS::DOMElement* node) = 0; ///< Invoked when entering the element as part of evaluating executable content. + virtual void exitElement(XERCESC_NS::DOMElement* node) = 0; ///< Invoked when exiting the element as part of evaluating executable content. + virtual bool processChildren() = 0; ///< Whether or not the interpreter should process this elements children. + +protected: + InterpreterImpl* _interpreter; +}; + + +} + +#endif /* end of include guard: EXECUTABLECONTENTIMPL_H_CCE9F02D */ diff --git a/src/uscxml/plugins/Factory.cpp b/src/uscxml/plugins/Factory.cpp index 7c68a30..3600dd1 100644 --- a/src/uscxml/plugins/Factory.cpp +++ b/src/uscxml/plugins/Factory.cpp @@ -24,6 +24,8 @@ #include "uscxml/Interpreter.h" #include <easylogging++.h> +#include "uscxml/plugins/ExecutableContentImpl.h" + // see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system // we will always include these in a build @@ -275,7 +277,6 @@ std::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, std::string canonicalName = _dataModelAliases[type]; if (_dataModels.find(canonicalName) != _dataModels.end()) { std::shared_ptr<DataModelImpl> dataModel = _dataModels[canonicalName]->create(callbacks); - dataModel->setCallbacks(callbacks); return dataModel; } } diff --git a/src/uscxml/plugins/Factory.h b/src/uscxml/plugins/Factory.h index 0ce2af9..e0015b5 100644 --- a/src/uscxml/plugins/Factory.h +++ b/src/uscxml/plugins/Factory.h @@ -26,7 +26,7 @@ #include "uscxml/plugins/EventHandler.h" #include "uscxml/plugins/IOProcessor.h" #include "uscxml/plugins/Invoker.h" -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <string.h> diff --git a/src/uscxml/plugins/IOProcessor.cpp b/src/uscxml/plugins/IOProcessor.cpp new file mode 100644 index 0000000..435d3b6 --- /dev/null +++ b/src/uscxml/plugins/IOProcessor.cpp @@ -0,0 +1,37 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#include "IOProcessor.h" +#include "IOProcessorImpl.h" + +namespace uscxml { + +PIMPL_OPERATORS_INHERIT_IMPL(IOProcessor, EventHandler) + +void IOProcessor::eventFromSCXML(const std::string& target, const Event& event) { + _impl->eventFromSCXML(target, event); +} + +bool IOProcessor::isValidTarget(const std::string& target) { + return _impl->isValidTarget(target); +} + + +} + diff --git a/src/uscxml/plugins/IOProcessor.h b/src/uscxml/plugins/IOProcessor.h index c7d90e5..558edfa 100644 --- a/src/uscxml/plugins/IOProcessor.h +++ b/src/uscxml/plugins/IOProcessor.h @@ -26,31 +26,25 @@ namespace uscxml { +class IOProcessorImpl; class InterpreterImpl; -class USCXML_API IOProcessorImpl : public EventHandlerImpl { -public: - - virtual std::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0; - virtual void eventFromSCXML(const std::string& target, const Event& event) = 0; - virtual bool isValidTarget(const std::string& target) = 0; - -protected: - void eventToSCXML(Event& event, const std::string& type, const std::string& origin, bool internal = false); - -}; - +/** + * @ingroup ioproc + * @ingroup facade + * Facade for I/O processors. + */ class USCXML_API IOProcessor : public EventHandler { public: - PIMPL_OPERATORS2(IOProcessor, EventHandler) - virtual void eventFromSCXML(const std::string& target, const Event& event) { - _impl->eventFromSCXML(target, event); - } + PIMPL_OPERATORS_INHERIT(IOProcessor, EventHandler); + + /// @copydoc IOProcessorImpl::eventFromSCXML + virtual void eventFromSCXML(const std::string& target, const Event& event); + + /// @copydoc IOProcessorImpl::isValidTarget + virtual bool isValidTarget(const std::string& target); - virtual bool isValidTarget(const std::string& target) { - return _impl->isValidTarget(target); - } protected: std::shared_ptr<IOProcessorImpl> _impl; diff --git a/src/uscxml/plugins/IOProcessorImpl.h b/src/uscxml/plugins/IOProcessorImpl.h new file mode 100644 index 0000000..0e5b44a --- /dev/null +++ b/src/uscxml/plugins/IOProcessorImpl.h @@ -0,0 +1,74 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#ifndef IOPROCESSORIMPL_H_92E6AA44 +#define IOPROCESSORIMPL_H_92E6AA44 + + +#include "uscxml/Common.h" +#include "uscxml/plugins/EventHandler.h" +#include "uscxml/messages/Event.h" + +namespace uscxml { + +/** + * @ingroup ioproc + * @ingroup abstract + * Abstract base class for IOProcessor%s implementations. + */ +class USCXML_API IOProcessorImpl : public EventHandlerImpl { +public: + + /** + * Factory demands a new instance. + * @param interpreter The imlementation of the associated Interpreter + * @todo We will eventually introduce callbacks and prevent complete access to the interpreter. + */ + virtual std::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0; + + /** + * We received an event from the SCXML Interpreter we are associated with. + * @param target Where the event is supposed to be delivered to. + * @param event The event to deliver. + */ + virtual void eventFromSCXML(const std::string& target, const Event& event) = 0; + + /** + * Determine whether the given target is a valid destination for events. + * @param target A target where the Interpreter wants to deliver Event%s to. + * @return Whether or not the target is valid. + */ + virtual bool isValidTarget(const std::string& target) = 0; + +protected: + /** + * Return an event to the SCXML Interpreter instance. + * @param event An event to enqueue at the interpreter's external queue. + * @param type The type of this I/O Processor for `event.origintype`. + * @param origin The origin of this I/O Processor for `event.origin`. + * @param internal If the event is to be delivered to the Interpreter's internal queue instead. + */ + void eventToSCXML(Event& event, const std::string& type, const std::string& origin, bool internal = false); + +}; + +} + + +#endif /* end of include guard: IOPROCESSORIMPL_H_92E6AA44 */ diff --git a/src/uscxml/plugins/Invoker.cpp b/src/uscxml/plugins/Invoker.cpp new file mode 100644 index 0000000..a021ff7 --- /dev/null +++ b/src/uscxml/plugins/Invoker.cpp @@ -0,0 +1,43 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#include "Invoker.h" +#include "InvokerImpl.h" + +namespace uscxml { + +PIMPL_OPERATORS_INHERIT_IMPL(Invoker, EventHandler) + +void Invoker::invoke(const std::string& source, const Event& invokeEvent) { + _impl->invoke(source, invokeEvent); +} + +void Invoker::uninvoke() { + _impl->uninvoke(); +} + +void Invoker::eventFromSCXML(const Event& event) { + _impl->eventFromSCXML(event); +} + +XERCESC_NS::DOMElement* Invoker::getFinalize() { + return _impl->getFinalize(); +} + +} diff --git a/src/uscxml/plugins/Invoker.h b/src/uscxml/plugins/Invoker.h index c22b7e3..33a89d6 100644 --- a/src/uscxml/plugins/Invoker.h +++ b/src/uscxml/plugins/Invoker.h @@ -21,63 +21,42 @@ #define INVOKER_H_CAC11892 +#include "uscxml/config.h" #include "uscxml/Common.h" #include "uscxml/plugins/EventHandler.h" #include "uscxml/messages/Event.h" +#include <xercesc/dom/DOM.hpp> -namespace uscxml { - -class Interpreter; - -class USCXML_API InvokerImpl : public EventHandlerImpl { -public: - InvokerImpl() : _finalize(NULL) {}; - virtual ~InvokerImpl() {} - virtual std::list<std::string> getNames() = 0; - - virtual void invoke(const std::string& source, const Event& invokeEvent) = 0; - virtual void uninvoke() = 0; - - virtual void eventFromSCXML(const Event& event) = 0; - - virtual std::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) = 0; - virtual xercesc::DOMElement* getFinalize() { - return _finalize; - } - virtual void setFinalize(xercesc::DOMElement* finalize) { - _finalize = finalize; - } - virtual void setInvokeId(const std::string& invokeId) { - _invokeId = invokeId; - } - -protected: - void eventToSCXML(Event& event, const std::string& type, const std::string& invokeId, bool internal = false); +namespace XERCESC_NS { + class DOMDocument; + class DOMNode; +} - xercesc::DOMElement* _finalize; - std::string _invokeId; +namespace uscxml { -}; +class InvokerImpl; +/** + * @ingroup invoker + * @ingroup facade + * Facade for invoker implementation. + */ class USCXML_API Invoker : public EventHandler { public: - PIMPL_OPERATORS2(Invoker, EventHandler); + PIMPL_OPERATORS_INHERIT(Invoker, EventHandler); + + /// @copydoc InvokerImpl::invoke + virtual void invoke(const std::string& source, const Event& invokeEvent); - virtual void invoke(const std::string& source, const Event& invokeEvent) { - _impl->invoke(source, invokeEvent); - } + /// @copydoc InvokerImpl::uninvoke + virtual void uninvoke(); - virtual void uninvoke() { - _impl->uninvoke(); - } + /// @copydoc InvokerImpl::eventFromSCXML + virtual void eventFromSCXML(const Event& event); - virtual void eventFromSCXML(const Event& event) { - _impl->eventFromSCXML(event); - } + /// @copydoc InvokerImpl::getFinalize + virtual XERCESC_NS::DOMElement* getFinalize(); - virtual xercesc::DOMElement* getFinalize() { - return _impl->getFinalize(); - } protected: std::shared_ptr<InvokerImpl> _impl; }; diff --git a/src/uscxml/plugins/InvokerImpl.h b/src/uscxml/plugins/InvokerImpl.h new file mode 100644 index 0000000..d8a3410 --- /dev/null +++ b/src/uscxml/plugins/InvokerImpl.h @@ -0,0 +1,110 @@ +/** + * @file + * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#ifndef INVOKERIMPL_H_8A15A102 +#define INVOKERIMPL_H_8A15A102 + + +#include "uscxml/config.h" +#include "uscxml/Common.h" +#include "uscxml/plugins/EventHandler.h" +#include "uscxml/messages/Event.h" + +namespace uscxml { + +class Interpreter; + +/** + * @ingroup invoker + * @ingroup abstract + * Abstract base class for all invokers. + */ +class USCXML_API InvokerImpl : public EventHandlerImpl { +public: + InvokerImpl() : _finalize(NULL) {}; + virtual ~InvokerImpl() {} + + virtual std::list<std::string> getNames() = 0; + + /** + * Factory demands a new instance. + * @param interpreter The imlementation of the associated Interpreter + * @todo We will eventually introduce callbacks and prevent complete access to the interpreter. + */ + virtual std::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) = 0; + + /** + * Invoker's parent state became active at the end of a macro-step. + * @param source The content of the invoke's `src` or evaluated `srcexpr` attribute + * @param invokeEvent The invocation with all its data as an event + */ + virtual void invoke(const std::string& source, const Event& invokeEvent) = 0; + + /** + * The invokers's parent state was left at the end of a macro-step. + */ + virtual void uninvoke() = 0; + + /** + * Interpreter received an event from the SCXML Interpreter. + */ + virtual void eventFromSCXML(const Event& event) = 0; + + /** + * Return the finalize XML element associated with this invoker. + */ + virtual XERCESC_NS::DOMElement* getFinalize() { + return _finalize; + } + + /** + * Set the finalize XML element associated with this invoker. + * @param finalize The finalize XMl element. + */ + virtual void setFinalize(XERCESC_NS::DOMElement* finalize) { + _finalize = finalize; + } + + /** + * Set the invocation identifier as required when returning events. + * @param invokeId The invocation identifier. + */ + virtual void setInvokeId(const std::string& invokeId) { + _invokeId = invokeId; + } + +protected: + /** + * Return an event to the SCXML Interpreter instance. + * @param event An event to enqueue at the interpreter's external queue. + * @param type The type of this I/O Processor for `event.origintype`. + * @param invokeId The invocation identifier of this invocation for `event.invokeid`. + * @param internal If the event is to be delivered to the Interpreter's internal queue instead. + */ + void eventToSCXML(Event& event, const std::string& type, const std::string& invokeId, bool internal = false); + + XERCESC_NS::DOMElement* _finalize; + std::string _invokeId; + +}; + +} + + +#endif /* end of include guard: INVOKERIMPL_H_8A15A102 */ diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index d43efbe..35d9c4b 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -43,12 +43,12 @@ if (exception) \ handleException(exception); -using namespace xercesc; +using namespace XERCESC_NS; static JSValueRef XMLString2JS(const XMLCh* input, JSContextRef context) { JSValueRef output; - char* res = xercesc::XMLString::transcode(input); + char* res = XERCESC_NS::XMLString::transcode(input); JSStringRef stringRef = JSStringCreateWithUTF8CString(res); output = JSValueMakeString(context, stringRef); @@ -70,7 +70,7 @@ static XMLCh* JS2XMLString(JSValueRef input, JSContextRef context) { char* output = new char[maxSize + 1]; JSStringGetUTF8CString(stringInput, output, maxSize); - XMLCh* ret = xercesc::XMLString::transcode(output); + XMLCh* ret = XERCESC_NS::XMLString::transcode(output); return(ret); } @@ -509,7 +509,7 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) { // dom node void* privData = NULL; SWIG_JSC_ConvertPtr(_ctx, value, &privData, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0); - data.node = (xercesc::DOMNode*)privData; + data.node = (XERCESC_NS::DOMNode*)privData; return data; } std::set<std::string> propertySet; diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h index b65dc37..c5129a4 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h @@ -21,14 +21,10 @@ #define JSCDATAMODEL_H_KN8TWG0V #include "uscxml/config.h" -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> #include <set> -/** - * There are two variants with JavaScriptCore headers - * Still beats the >20 V8 variants =D - */ #if defined(HAS_JSC_JAVASCRIPTCORE_H) #include <JavaScriptCore/JavaScriptCore.h> #elif defined(HAS_JSC_JAVASCRIPT_H) @@ -48,6 +44,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * + * ECMAScript data-model via JavaScriptCore. + */ class JSCDataModel : public DataModelImpl { public: JSCDataModel(); @@ -103,7 +104,7 @@ protected: static JSValueRef jsInvokerGetProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static void jsInvokerListProps(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); - JSValueRef getNodeAsValue(const xercesc::DOMNode* node); + JSValueRef getNodeAsValue(const XERCESC_NS::DOMNode* node); JSValueRef getDataAsValue(const Data& data); Data getValueAsData(const JSValueRef value); JSValueRef evalAsValue(const std::string& expr, bool dontThrow = false); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index bfa29d8..3ccadcd 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -33,17 +33,17 @@ #include "uscxml/util/DOM.h" #include <easylogging++.h> -using namespace xercesc; +using namespace XERCESC_NS; static v8::Local<v8::Value> XMLString2JS(const XMLCh* input) { - char* res = xercesc::XMLString::transcode(input); + char* res = XERCESC_NS::XMLString::transcode(input); v8::Local<v8::Value> handle = v8::String::New(res); return handle; } static XMLCh* JS2XMLString(const v8::Local<v8::Value>& value) { v8::String::AsciiValue s(value); - XMLCh* ret = xercesc::XMLString::transcode(*s); + XMLCh* ret = XERCESC_NS::XMLString::transcode(*s); return(ret); } @@ -137,11 +137,11 @@ std::mutex V8DataModel::_initMutex; v8::Isolate* V8DataModel::_isolate = NULL; void V8NodeListIndexedPropertyHandler(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { - xercesc::DOMNodeList* list; + XERCESC_NS::DOMNodeList* list; SWIG_V8_GetInstancePtr(info.Holder(), (void**)&list); if (list->getLength() >= index) { - xercesc::DOMNode* node = list->item(index); + XERCESC_NS::DOMNode* node = list->item(index); v8::Handle<v8::Value> val = SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), 0 | 0 ); info.GetReturnValue().Set(val); @@ -528,7 +528,7 @@ Data V8DataModel::getValueAsData(const v8::Local<v8::Value>& value, std::set<v8: return data; } -v8::Local<v8::Value> V8DataModel::getNodeAsValue(const xercesc::DOMNode* node) { +v8::Local<v8::Value> V8DataModel::getNodeAsValue(const XERCESC_NS::DOMNode* node) { return SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index 29b2b58..91ac48d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -20,7 +20,8 @@ #ifndef V8DATAMODEL_H_KN8TWG0V #define V8DATAMODEL_H_KN8TWG0V -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" + #include <list> #include <set> #include <v8.h> @@ -36,6 +37,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * ECMAScript data-model via Google's V8. + */ + class V8DataModel : public DataModelImpl { public: V8DataModel(); @@ -95,7 +101,7 @@ protected: v8::Local<v8::Value> evalAsValue(const std::string& expr, bool dontThrow = false); v8::Local<v8::Value> getDataAsValue(const Data& data); Data getValueAsData(const v8::Local<v8::Value>& value); - v8::Local<v8::Value> getNodeAsValue(const xercesc::DOMNode* node); + v8::Local<v8::Value> getNodeAsValue(const XERCESC_NS::DOMNode* node); void throwExceptionEvent(const v8::TryCatch& tryCatch); std::set<DataModelExtension*> _extensions; diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h index 4e2fd43..7b7121f 100644 --- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h +++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h @@ -20,7 +20,7 @@ #ifndef LUADATAMODEL_H_113E014C #define LUADATAMODEL_H_113E014C -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> extern "C" { @@ -41,6 +41,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * Lua data-model. + */ + class LuaDataModel : public DataModelImpl { public: LuaDataModel(); diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp index 773a970..53c414f 100644 --- a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp +++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp @@ -63,7 +63,7 @@ Data NULLDataModel::getAsData(const std::string& content) { * The predicate must return 'true' if and only if that state is in the current * state configuration. */ -bool NULLDataModel::evalAsBool(const xercesc::DOMElement* scriptNode, const std::string& expr) { +bool NULLDataModel::evalAsBool(const XERCESC_NS::DOMElement* scriptNode, const std::string& expr) { std::string trimmedExpr = expr; boost::trim(trimmedExpr); if (!boost::istarts_with(trimmedExpr, "in")) diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.h b/src/uscxml/plugins/datamodel/null/NULLDataModel.h index c584357..4bea664 100644 --- a/src/uscxml/plugins/datamodel/null/NULLDataModel.h +++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.h @@ -20,7 +20,7 @@ #ifndef NULLDATAMODEL_H_KN8TWG0V #define NULLDATAMODEL_H_KN8TWG0V -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> #ifdef BUILD_AS_PLUGINS @@ -34,6 +34,10 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * NULL data-model. + */ class NULLDataModel : public DataModelImpl { public: NULLDataModel(); @@ -76,7 +80,7 @@ public: return expr; } - virtual bool evalAsBool(const xercesc::DOMElement* scriptNode, + virtual bool evalAsBool(const XERCESC_NS::DOMElement* scriptNode, const std::string& expr); virtual bool evalAsBool(const std::string& expr) { return evalAsBool(NULL, expr); @@ -86,13 +90,13 @@ public: return true; } - virtual void assign(const xercesc::DOMElement* assignElem, - const xercesc::DOMNode* node, + virtual void assign(const XERCESC_NS::DOMElement* assignElem, + const XERCESC_NS::DOMNode* node, const std::string& content) {} virtual void assign(const std::string& location, const Data& data) {} - virtual void init(const xercesc::DOMElement* dataElem, - const xercesc::DOMNode* node, + virtual void init(const XERCESC_NS::DOMElement* dataElem, + const XERCESC_NS::DOMNode* node, const std::string& content) {} virtual void init(const std::string& location, const Data& data) {} diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index 4d3c579..f80d427 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -32,7 +32,7 @@ namespace uscxml { // msxml.h should die in a fire for polluting the global namespace -// using namespace xercesc; +// using namespace XERCESC_NS; #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR @@ -136,11 +136,11 @@ void USCXMLInvoker::invoke(const std::string& source, const Event& invokeEvent) if (source.length() > 0) { _invokedInterpreter = Interpreter::fromURL(source); } else if (invokeEvent.data.node) { - xercesc::DOMImplementation* implementation = xercesc::DOMImplementationRegistry::getDOMImplementation(X("core")); - xercesc::DOMDocument* document = implementation->createDocument(); + XERCESC_NS::DOMImplementation* implementation = XERCESC_NS::DOMImplementationRegistry::getDOMImplementation(X("core")); + XERCESC_NS::DOMDocument* document = implementation->createDocument(); // we need to import the parent - to support xpath test150 - xercesc::DOMNode* newNode = document->importNode(invokeEvent.data.node, true); + XERCESC_NS::DOMNode* newNode = document->importNode(invokeEvent.data.node, true); document->appendChild(newNode); // std::cout << *document << std::endl; diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index dac8d8b..f896bac 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -20,8 +20,11 @@ #ifndef USCXMLINVOKER_H_OQFA21IO #define USCXMLINVOKER_H_OQFA21IO -#include <uscxml/Interpreter.h> -#include "uscxml/interpreter/EventQueueImpl.h" +#include "uscxml/interpreter/InterpreterImpl.h" +#include "uscxml/interpreter/BasicEventQueue.h" + +#include "uscxml/plugins/Invoker.h" +#include "uscxml/plugins/InvokerImpl.h" #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" @@ -31,11 +34,15 @@ namespace uscxml { +/** +* @ingroup invoker + * An invoker for other SCXML instances. + */ class USCXMLInvoker : public InvokerImpl, public std::enable_shared_from_this<USCXMLInvoker> { public: - class ParentQueueImpl : public EventQueueImpl { + class ParentQueueImpl : public BasicEventQueue { public: ParentQueueImpl(USCXMLInvoker* invoker) : _invoker(invoker) {} virtual void enqueue(const Event& event); diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h index f7e9f10..b70ce8e 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h +++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h @@ -36,8 +36,9 @@ extern "C" { #endif #include "uscxml/server/HTTPServer.h" -#include "uscxml/Interpreter.h" -#include "uscxml/plugins/Factory.h" +#include "uscxml/interpreter/InterpreterImpl.h" +#include "uscxml/plugins/IOProcessorImpl.h" + #ifndef _WIN32 #include <sys/time.h> #endif @@ -50,6 +51,10 @@ extern "C" { namespace uscxml { +/** + * @ingroup ioproc + * The basichttp I/O processor as per standard. + */ class USCXML_PLUGIN_API BasicHTTPIOProcessor : public IOProcessorImpl, public HTTPServlet, public URLMonitor { public: BasicHTTPIOProcessor(); diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h index 3b08e30..21fd13a 100644 --- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h +++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h @@ -20,10 +20,14 @@ #ifndef SCXMLIOProcessor_H_2CUY93KU #define SCXMLIOProcessor_H_2CUY93KU -#include "uscxml/plugins/IOProcessor.h" +#include "uscxml/plugins/IOProcessorImpl.h" namespace uscxml { +/** + * @ingroup ioproc + * The scxml I/O processor as per standard. + */ class SCXMLIOProcessor : public IOProcessorImpl { public: SCXMLIOProcessor(); |