summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-05-26 10:36:49 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-05-26 10:36:49 (GMT)
commit6e13c7b6e0888323223afd5d2e36e86243df57af (patch)
treef558fd45fa499c8bc95041554ecad6be1bf788c1 /src/uscxml
parentf6714b1484b641ea61053350b7d156d2da760b8b (diff)
downloaduscxml-6e13c7b6e0888323223afd5d2e36e86243df57af.zip
uscxml-6e13c7b6e0888323223afd5d2e36e86243df57af.tar.gz
uscxml-6e13c7b6e0888323223afd5d2e36e86243df57af.tar.bz2
Minor polishing for Java bindings and first draft of JEXL datamodel
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/Interpreter.cpp6
-rw-r--r--src/uscxml/Interpreter.h24
-rw-r--r--src/uscxml/debug/InterpreterIssue.h10
-rw-r--r--src/uscxml/interpreter/BasicEventQueue.cpp15
-rw-r--r--src/uscxml/interpreter/BasicEventQueue.h6
-rw-r--r--src/uscxml/interpreter/ContentExecutor.h2
-rw-r--r--src/uscxml/interpreter/EventQueue.cpp4
-rw-r--r--src/uscxml/interpreter/EventQueue.h2
-rw-r--r--src/uscxml/interpreter/EventQueueImpl.h2
-rw-r--r--src/uscxml/interpreter/FastMicroStep.cpp24
-rw-r--r--src/uscxml/interpreter/FastMicroStep.h2
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp4
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.h6
-rw-r--r--src/uscxml/interpreter/InterpreterMonitor.h6
-rw-r--r--src/uscxml/interpreter/InterpreterState.h3
-rw-r--r--src/uscxml/interpreter/MicroStep.cpp4
-rw-r--r--src/uscxml/interpreter/MicroStep.h4
-rw-r--r--src/uscxml/interpreter/MicroStepImpl.h4
-rw-r--r--src/uscxml/messages/Data.h4
-rw-r--r--src/uscxml/plugins/DataModel.h2
-rw-r--r--src/uscxml/plugins/DataModelImpl.h52
-rw-r--r--src/uscxml/plugins/EventHandler.h2
-rw-r--r--src/uscxml/plugins/ExecutableContent.h4
-rw-r--r--src/uscxml/plugins/IOProcessor.h2
-rw-r--r--src/uscxml/plugins/IOProcessorImpl.h5
-rw-r--r--src/uscxml/plugins/Invoker.h4
-rw-r--r--src/uscxml/plugins/InvokerImpl.h9
-rw-r--r--src/uscxml/util/DOM.cpp4
-rw-r--r--src/uscxml/util/DOM.h2
-rw-r--r--src/uscxml/util/URL.cpp4
-rw-r--r--src/uscxml/util/URL.h2
31 files changed, 122 insertions, 102 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 05fb1fc..a050401 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -192,8 +192,8 @@ void Interpreter::reset() {
return _impl->reset();
}
-InterpreterState Interpreter::step(bool blocking) {
- return _impl->step(blocking);
+InterpreterState Interpreter::step(size_t blockMs) {
+ return _impl->step(blockMs);
};
void Interpreter::cancel() {
@@ -239,7 +239,7 @@ static void printNodeSet(const std::list<XERCESC_NS::DOMElement*> nodes) {
}
}
#endif
-
+
void StateTransitionMonitor::beforeTakingTransition(const XERCESC_NS::DOMElement* transition) {
std::lock_guard<std::recursive_mutex> lock(_mutex);
std::cerr << "Transition: " << uscxml::DOMUtils::xPathForNode(transition) << std::endl;
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 1596914..bab0ebc 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -154,13 +154,19 @@ public:
PIMPL_OPERATORS(Interpreter);
/**
- * Perform a single microstep and return.
- * @param blocking Whether or not to block the thread when waiting for events
- * @return The new state of the interpreter object.
+ * Advance the state-machine by a single microstep and return.
+ *
+ * This is the central function to drive the state machine. Calling step()
+ * will perform one *microstep* and return the current state of the
+ * interpreter. Here, the state is not to be confused with the interpreter's
+ * configuration.
*
- * @todo Have Interpreter::step() take a duration to block
+ * \snippet test-snippets.cpp Performing a microstep
+ *
+ * @param blockMs The maximum duration in milli-seconds to wait for an event to become available.
+ * @return The new state of the interpreter object.
*/
- InterpreterState step(bool blocking = true);
+ InterpreterState step(size_t blockMs = std::numeric_limits<size_t>::max());
/**
* Unblock and mark for finalize.
@@ -177,14 +183,14 @@ public:
* @return A list of XML elements of the active states.
*/
std::list<XERCESC_NS::DOMElement*> getConfiguration();
-
+
/**
* Determine whether the state with the given `id` is in the active configuration.
* @param id An identifier for a state from the SCXML document.
* @return Whether the interpreter is in state `id`.
*/
bool isInState(const std::string& stateId);
-
+
/**
* The current state of the interpreter, not to be confused with its configuration.
* @return The current state of the interpreter object.
@@ -202,12 +208,12 @@ public:
* @event An event to be enqueued
*/
void receive(const Event& event);
-
+
/**
* Adapt the constituting components for a SCXML interpreter.
*/
void setActionLanguage(ActionLanguage actionLanguage);
-
+
/**
* Attach a monitor to make more details of the interpreter observable.
*/
diff --git a/src/uscxml/debug/InterpreterIssue.h b/src/uscxml/debug/InterpreterIssue.h
index c807acc..7eede09 100644
--- a/src/uscxml/debug/InterpreterIssue.h
+++ b/src/uscxml/debug/InterpreterIssue.h
@@ -29,7 +29,7 @@
// forward declare
namespace XERCESC_NS {
- class DOMNode;
+class DOMNode;
}
namespace uscxml {
@@ -54,10 +54,10 @@ public:
IssueSeverity severity; ///< Severity of the issue
std::string specRef; ///< If applicable, the violated section from the standard
- /**
- * Constructor is solely used to report issues at runtime.
- */
- InterpreterIssue(const std::string& msg, XERCESC_NS::DOMNode* node, IssueSeverity severity, const std::string& specRef = "");
+ /**
+ * Constructor is solely used to report issues at runtime.
+ */
+ InterpreterIssue(const std::string& msg, XERCESC_NS::DOMNode* node, IssueSeverity severity, const std::string& specRef = "");
private:
diff --git a/src/uscxml/interpreter/BasicEventQueue.cpp b/src/uscxml/interpreter/BasicEventQueue.cpp
index 5d3fa2d..ee2346d 100644
--- a/src/uscxml/interpreter/BasicEventQueue.cpp
+++ b/src/uscxml/interpreter/BasicEventQueue.cpp
@@ -31,13 +31,20 @@ BasicEventQueue::BasicEventQueue() {
BasicEventQueue::~BasicEventQueue() {
}
-Event BasicEventQueue::dequeue(bool blocking) {
+Event BasicEventQueue::dequeue(size_t blockMs) {
std::lock_guard<std::recursive_mutex> lock(_mutex);
- if (blocking) {
- while (_queue.empty()) {
- _cond.wait(_mutex);
+
+ if (blockMs > 0) {
+ // block for given milliseconds or until queue is filled
+ std::chrono::time_point<std::chrono::system_clock> end, now;
+ now = std::chrono::system_clock::now();
+ end = now + std::chrono::milliseconds(blockMs);
+
+ while (std::chrono::system_clock::now() < end && _queue.empty()) {
+ _cond.wait_for(_mutex, std::chrono::system_clock::now() - end);
}
}
+
if (_queue.size() > 0) {
Event event = _queue.front();
_queue.pop_front();
diff --git a/src/uscxml/interpreter/BasicEventQueue.h b/src/uscxml/interpreter/BasicEventQueue.h
index cfb2b5d..15a1c3c 100644
--- a/src/uscxml/interpreter/BasicEventQueue.h
+++ b/src/uscxml/interpreter/BasicEventQueue.h
@@ -42,7 +42,7 @@ class USCXML_API BasicEventQueue : public EventQueueImpl {
public:
BasicEventQueue();
virtual ~BasicEventQueue();
- virtual Event dequeue(bool blocking);
+ virtual Event dequeue(size_t blockMs);
virtual void enqueue(const Event& event);
protected:
@@ -62,8 +62,8 @@ public:
virtual void enqueueDelayed(const Event& event, size_t delayMs, const std::string& eventUUID);
virtual void cancelDelayed(const std::string& eventId);
virtual void cancelAllDelayed();
- virtual Event dequeue(bool blocking) {
- return BasicEventQueue::dequeue(blocking);
+ virtual Event dequeue(size_t blockMs) {
+ return BasicEventQueue::dequeue(blockMs);
}
virtual void enqueue(const Event& event) {
return BasicEventQueue::enqueue(event);
diff --git a/src/uscxml/interpreter/ContentExecutor.h b/src/uscxml/interpreter/ContentExecutor.h
index 64f5a95..be0de78 100644
--- a/src/uscxml/interpreter/ContentExecutor.h
+++ b/src/uscxml/interpreter/ContentExecutor.h
@@ -28,7 +28,7 @@
// forward declare
namespace XERCESC_NS {
- class DOMElement;
+class DOMElement;
}
namespace uscxml {
diff --git a/src/uscxml/interpreter/EventQueue.cpp b/src/uscxml/interpreter/EventQueue.cpp
index 9b9fa88..c460e02 100644
--- a/src/uscxml/interpreter/EventQueue.cpp
+++ b/src/uscxml/interpreter/EventQueue.cpp
@@ -32,8 +32,8 @@
namespace uscxml {
-Event EventQueue::dequeue(bool blocking) {
- return _impl->dequeue(blocking);
+Event EventQueue::dequeue(size_t blockMs) {
+ return _impl->dequeue(blockMs);
}
void EventQueue::enqueue(const Event& event) {
return _impl->enqueue(event);
diff --git a/src/uscxml/interpreter/EventQueue.h b/src/uscxml/interpreter/EventQueue.h
index 4409b72..1e8b018 100644
--- a/src/uscxml/interpreter/EventQueue.h
+++ b/src/uscxml/interpreter/EventQueue.h
@@ -36,7 +36,7 @@ class USCXML_API EventQueue {
public:
PIMPL_OPERATORS(EventQueue);
- virtual Event dequeue(bool blocking);
+ virtual Event dequeue(size_t blockMs);
virtual void enqueue(const Event& event);
protected:
diff --git a/src/uscxml/interpreter/EventQueueImpl.h b/src/uscxml/interpreter/EventQueueImpl.h
index 1cafd4d..1ccd3f1 100644
--- a/src/uscxml/interpreter/EventQueueImpl.h
+++ b/src/uscxml/interpreter/EventQueueImpl.h
@@ -40,7 +40,7 @@ namespace uscxml {
*/
class USCXML_API EventQueueImpl {
public:
- virtual Event dequeue(bool blocking) = 0;
+ virtual Event dequeue(size_t blockMs) = 0;
virtual void enqueue(const Event& event) = 0;
};
diff --git a/src/uscxml/interpreter/FastMicroStep.cpp b/src/uscxml/interpreter/FastMicroStep.cpp
index bf58f7b..3ad5515 100644
--- a/src/uscxml/interpreter/FastMicroStep.cpp
+++ b/src/uscxml/interpreter/FastMicroStep.cpp
@@ -290,23 +290,23 @@ void FastMicroStep::init(XERCESC_NS::DOMElement* scxml) {
if (parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
State* uscxmlState = (State*)parent->getUserData(X("uscxmlState"));
// parent maybe a content element
- if (uscxmlState != NULL) {
- _states[i]->parent = uscxmlState->documentOrder;
- }
+ if (uscxmlState != NULL) {
+ _states[i]->parent = uscxmlState->documentOrder;
+ }
}
while(parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
State* uscxmlState = (State*)parent->getUserData(X("uscxmlState"));
- if (uscxmlState == NULL)
- break;
+ if (uscxmlState == NULL)
+ break;
- // ancestors
- BIT_SET_AT(uscxmlState->documentOrder, _states[i]->ancestors);
+ // ancestors
+ BIT_SET_AT(uscxmlState->documentOrder, _states[i]->ancestors);
- // children
- BIT_SET_AT(i, uscxmlState->children);
- parent = parent->getParentNode();
+ // children
+ BIT_SET_AT(i, uscxmlState->children);
+ parent = parent->getParentNode();
}
}
@@ -403,7 +403,7 @@ void FastMicroStep::markAsCancelled() {
_isCancelled = true;
}
-InterpreterState FastMicroStep::step(bool blocking) {
+InterpreterState FastMicroStep::step(size_t blockMs) {
if (!_isInitialized) {
init(_scxml);
return USCXML_INITIALIZED;
@@ -517,7 +517,7 @@ InterpreterState FastMicroStep::step(bool blocking) {
_flags |= USCXML_CTX_STABLE;
}
- if ((_event = _callbacks->dequeueExternal(blocking))) {
+ if ((_event = _callbacks->dequeueExternal(blockMs))) {
USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeProcessingEvent, _event);
goto SELECT_TRANSITIONS;
}
diff --git a/src/uscxml/interpreter/FastMicroStep.h b/src/uscxml/interpreter/FastMicroStep.h
index 3789af9..023bb8f 100644
--- a/src/uscxml/interpreter/FastMicroStep.h
+++ b/src/uscxml/interpreter/FastMicroStep.h
@@ -42,7 +42,7 @@ public:
FastMicroStep(MicroStepCallbacks* callbacks);
virtual ~FastMicroStep();
- virtual InterpreterState step(bool blocking);
+ virtual InterpreterState step(size_t blockMs);
virtual void reset();
virtual bool isInState(const std::string& stateId);
virtual std::list<XERCESC_NS::DOMElement*> getConfiguration();
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
index 880afbc..3383411 100644
--- a/src/uscxml/interpreter/InterpreterImpl.cpp
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -259,8 +259,8 @@ bool InterpreterImpl::checkValidSendType(const std::string& type, const std::str
return true;
}
-Event InterpreterImpl::dequeueExternal(bool blocking) {
- _currEvent = _externalQueue.dequeue(blocking);
+Event InterpreterImpl::dequeueExternal(size_t blockMs) {
+ _currEvent = _externalQueue.dequeue(blockMs);
if (_currEvent) {
_dataModel.setEvent(_currEvent);
diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h
index e1abf9b..e693bbf 100644
--- a/src/uscxml/interpreter/InterpreterImpl.h
+++ b/src/uscxml/interpreter/InterpreterImpl.h
@@ -65,12 +65,12 @@ public:
void cloneFrom(InterpreterImpl* other);
void cloneFrom(std::shared_ptr<InterpreterImpl> other);
- virtual InterpreterState step(bool blocking) {
+ virtual InterpreterState step(size_t blockMs) {
if (!_isInitialized) {
init();
_state = USCXML_INITIALIZED;
} else {
- _state = _microStepper.step(blocking);
+ _state = _microStepper.step(blockMs);
}
return _state;
}
@@ -107,7 +107,7 @@ public:
_dataModel.setEvent(_currEvent);
return _currEvent;
}
- virtual Event dequeueExternal(bool blocking);
+ virtual Event dequeueExternal(size_t blockMs);
virtual bool isTrue(const std::string& expr);
virtual void raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData) {
diff --git a/src/uscxml/interpreter/InterpreterMonitor.h b/src/uscxml/interpreter/InterpreterMonitor.h
index 901e1eb..8dac445 100644
--- a/src/uscxml/interpreter/InterpreterMonitor.h
+++ b/src/uscxml/interpreter/InterpreterMonitor.h
@@ -20,6 +20,7 @@
#ifndef INTERPRETERMONITOR_H_D3F21429
#define INTERPRETERMONITOR_H_D3F21429
+#include "uscxml/config.h"
#include "uscxml/Common.h"
#include "uscxml/messages/Event.h"
#include "uscxml/debug/InterpreterIssue.h"
@@ -41,6 +42,11 @@ if (callback) { callback->function(arg1); }
#define USCXML_MONITOR_CALLBACK2(callback, function, arg1, arg2) \
if (callback) { callback->function(arg1, arg2); }
+// forward declare
+namespace XERCESC_NS {
+ class DOMElement;
+}
+
namespace uscxml {
class USCXML_API InterpreterMonitor {
diff --git a/src/uscxml/interpreter/InterpreterState.h b/src/uscxml/interpreter/InterpreterState.h
index a4741ed..5acbd74 100644
--- a/src/uscxml/interpreter/InterpreterState.h
+++ b/src/uscxml/interpreter/InterpreterState.h
@@ -27,8 +27,7 @@
namespace uscxml {
enum InterpreterState {
- USCXML_FINISHED = -2, ///< machine reached a final configuration and is done
- USCXML_INTERRUPTED = -1, ///< machine received the empty event on the external queue
+ USCXML_FINISHED = -1, ///< machine reached a final configuration and is done
USCXML_UNDEF = 0, ///< not an actual state
USCXML_IDLE = 1, ///< stable configuration and queues empty
USCXML_INITIALIZED = 2, ///< DOM is setup and all external components instantiated
diff --git a/src/uscxml/interpreter/MicroStep.cpp b/src/uscxml/interpreter/MicroStep.cpp
index aa75c91..2876be5 100644
--- a/src/uscxml/interpreter/MicroStep.cpp
+++ b/src/uscxml/interpreter/MicroStep.cpp
@@ -22,8 +22,8 @@
namespace uscxml {
-InterpreterState MicroStep::step(bool blocking) {
- return _impl->step(blocking);
+InterpreterState MicroStep::step(size_t blockMs) {
+ return _impl->step(blockMs);
}
void MicroStep::reset() {
return _impl->reset();
diff --git a/src/uscxml/interpreter/MicroStep.h b/src/uscxml/interpreter/MicroStep.h
index c20e994..a8ea4f0 100644
--- a/src/uscxml/interpreter/MicroStep.h
+++ b/src/uscxml/interpreter/MicroStep.h
@@ -33,7 +33,7 @@
// forward declare
namespace XERCESC_NS {
- class DOMElement;
+class DOMElement;
}
namespace uscxml {
@@ -48,7 +48,7 @@ class USCXML_API MicroStep {
public:
PIMPL_OPERATORS(MicroStep);
- virtual InterpreterState step(bool blocking);
+ virtual InterpreterState step(size_t blockMs);
virtual void reset();
virtual bool isInState(const std::string& stateId);
diff --git a/src/uscxml/interpreter/MicroStepImpl.h b/src/uscxml/interpreter/MicroStepImpl.h
index e4cde5d..be9d974 100644
--- a/src/uscxml/interpreter/MicroStepImpl.h
+++ b/src/uscxml/interpreter/MicroStepImpl.h
@@ -41,7 +41,7 @@ class USCXML_API MicroStepCallbacks {
public:
/** Event Queues / Matching */
virtual Event dequeueInternal() = 0;
- virtual Event dequeueExternal(bool blocking) = 0;
+ virtual Event dequeueExternal(size_t blockMs) = 0;
virtual bool isMatched(const Event& event, const std::string& eventDesc) = 0;
virtual void raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData) = 0;
@@ -73,7 +73,7 @@ public:
MicroStepImpl(MicroStepCallbacks* callbacks) : _callbacks(callbacks) {}
- virtual InterpreterState step(bool blocking) = 0;
+ virtual InterpreterState step(size_t blockMs) = 0;
virtual void reset() = 0; ///< Reset state machine
virtual bool isInState(const std::string& stateId) = 0;
virtual std::list<XERCESC_NS::DOMElement*> getConfiguration() = 0;
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index 6ab3bec..73640f0 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -33,8 +33,8 @@
// forward declare
namespace XERCESC_NS {
- class DOMDocument;
- class DOMNode;
+class DOMDocument;
+class DOMNode;
}
namespace uscxml {
diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h
index 03e557c..7716ad7 100644
--- a/src/uscxml/plugins/DataModel.h
+++ b/src/uscxml/plugins/DataModel.h
@@ -43,7 +43,7 @@ public:
PIMPL_OPERATORS(DataModel);
/// @copydoc DataModelImpl::getNames()
- virtual std::list<std::string> getNames();
+ virtual std::list<std::string> getNames();
/// @copydoc DataModelImpl::isValidSyntax()
virtual bool isValidSyntax(const std::string& expr);
diff --git a/src/uscxml/plugins/DataModelImpl.h b/src/uscxml/plugins/DataModelImpl.h
index c3f5390..403a213 100644
--- a/src/uscxml/plugins/DataModelImpl.h
+++ b/src/uscxml/plugins/DataModelImpl.h
@@ -69,11 +69,11 @@ public:
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
+ * 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
@@ -87,7 +87,7 @@ public:
virtual std::list<std::string> getNames() = 0;
/**
- * Determine whether a given string constitutes valid syntax in the
+ * 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).
@@ -95,7 +95,7 @@ public:
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.
@@ -104,7 +104,7 @@ public:
/**
* Experimental extension to have dynamic content in string literals.
- * This function was used to replace ${foo} expressions on the data-model,
+ * 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.
@@ -116,8 +116,8 @@ public:
* @param expr Anything that possibly evaluates to an enumerable object.
* @return The number of items in the enumerable object.
*/
- virtual uint32_t getLength(const std::string& expr) = 0;
-
+ virtual uint32_t getLength(const std::string& expr) = 0;
+
/**
* Set a given item to the object at a given index for one iteration.
* @param item A variable or location to assign the current object to.
@@ -143,7 +143,7 @@ public:
* @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.
@@ -162,28 +162,28 @@ public:
/**
* 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
+ \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
+ * 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.
*/
@@ -194,10 +194,10 @@ test277:
* @todo This is currently unsupported
*/
virtual void addExtension(DataModelExtension* ext);
-
+
/**
* Concat the given terms into a conjunctive form.
- * @todo This is required to automatically transform a state-chart into a
+ * @todo This is required to automatically transform a state-chart into a
* state-machine. Actual transformation is still only available in legacy though.
*/
virtual std::string andExpressions(std::list<std::string>) {
diff --git a/src/uscxml/plugins/EventHandler.h b/src/uscxml/plugins/EventHandler.h
index e08b1ad..436f878 100644
--- a/src/uscxml/plugins/EventHandler.h
+++ b/src/uscxml/plugins/EventHandler.h
@@ -47,7 +47,7 @@ public:
* 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']`
diff --git a/src/uscxml/plugins/ExecutableContent.h b/src/uscxml/plugins/ExecutableContent.h
index 14c1d5d..5fb2ac6 100644
--- a/src/uscxml/plugins/ExecutableContent.h
+++ b/src/uscxml/plugins/ExecutableContent.h
@@ -29,7 +29,7 @@
// forward declare
namespace XERCESC_NS {
- class DOMElement;
+class DOMElement;
}
namespace uscxml {
@@ -50,7 +50,7 @@ public:
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/IOProcessor.h b/src/uscxml/plugins/IOProcessor.h
index 558edfa..c2b6e30 100644
--- a/src/uscxml/plugins/IOProcessor.h
+++ b/src/uscxml/plugins/IOProcessor.h
@@ -41,7 +41,7 @@ public:
/// @copydoc IOProcessorImpl::eventFromSCXML
virtual void eventFromSCXML(const std::string& target, const Event& event);
-
+
/// @copydoc IOProcessorImpl::isValidTarget
virtual bool isValidTarget(const std::string& target);
diff --git a/src/uscxml/plugins/IOProcessorImpl.h b/src/uscxml/plugins/IOProcessorImpl.h
index 0e5b44a..bd28406 100644
--- a/src/uscxml/plugins/IOProcessorImpl.h
+++ b/src/uscxml/plugins/IOProcessorImpl.h
@@ -24,6 +24,7 @@
#include "uscxml/Common.h"
#include "uscxml/plugins/EventHandler.h"
#include "uscxml/messages/Event.h"
+#include "uscxml/interpreter/InterpreterImpl.h"
namespace uscxml {
@@ -48,7 +49,7 @@ public:
* @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.
@@ -63,7 +64,7 @@ protected:
* @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);
};
diff --git a/src/uscxml/plugins/Invoker.h b/src/uscxml/plugins/Invoker.h
index 33a89d6..f5c55d5 100644
--- a/src/uscxml/plugins/Invoker.h
+++ b/src/uscxml/plugins/Invoker.h
@@ -28,8 +28,8 @@
#include <xercesc/dom/DOM.hpp>
namespace XERCESC_NS {
- class DOMDocument;
- class DOMNode;
+class DOMDocument;
+class DOMNode;
}
namespace uscxml {
diff --git a/src/uscxml/plugins/InvokerImpl.h b/src/uscxml/plugins/InvokerImpl.h
index d8a3410..7f2e578 100644
--- a/src/uscxml/plugins/InvokerImpl.h
+++ b/src/uscxml/plugins/InvokerImpl.h
@@ -25,6 +25,7 @@
#include "uscxml/Common.h"
#include "uscxml/plugins/EventHandler.h"
#include "uscxml/messages/Event.h"
+#include "uscxml/interpreter/InterpreterImpl.h"
namespace uscxml {
@@ -39,7 +40,7 @@ class USCXML_API InvokerImpl : public EventHandlerImpl {
public:
InvokerImpl() : _finalize(NULL) {};
virtual ~InvokerImpl() {}
-
+
virtual std::list<std::string> getNames() = 0;
/**
@@ -72,7 +73,7 @@ public:
virtual XERCESC_NS::DOMElement* getFinalize() {
return _finalize;
}
-
+
/**
* Set the finalize XML element associated with this invoker.
* @param finalize The finalize XMl element.
@@ -80,7 +81,7 @@ public:
virtual void setFinalize(XERCESC_NS::DOMElement* finalize) {
_finalize = finalize;
}
-
+
/**
* Set the invocation identifier as required when returning events.
* @param invokeId The invocation identifier.
@@ -96,7 +97,7 @@ protected:
* @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;
diff --git a/src/uscxml/util/DOM.cpp b/src/uscxml/util/DOM.cpp
index 0e1e9fa..ecf0960 100644
--- a/src/uscxml/util/DOM.cpp
+++ b/src/uscxml/util/DOM.cpp
@@ -194,12 +194,12 @@ bool DOMUtils::isMember(const DOMElement* node,
return false;
}
-const DOMNode* DOMUtils::getNearestAncestor(const DOMNode* node, const std::string tagName) {
+const DOMElement* DOMUtils::getNearestAncestor(const DOMNode* node, const std::string tagName) {
const DOMNode* parent = node->getParentNode();
while(parent) {
if (parent->getNodeType() == DOMNode::ELEMENT_NODE &&
iequals(TAGNAME_CAST(parent), tagName)) {
- return parent;
+ return static_cast<const DOMElement*>(parent);
}
parent = parent->getParentNode();
}
diff --git a/src/uscxml/util/DOM.h b/src/uscxml/util/DOM.h
index 0e8621c..f259ea0 100644
--- a/src/uscxml/util/DOM.h
+++ b/src/uscxml/util/DOM.h
@@ -59,7 +59,7 @@ namespace uscxml {
class USCXML_API DOMUtils {
public:
- static const XERCESC_NS::DOMNode* getNearestAncestor(const XERCESC_NS::DOMNode* node, const std::string tagName);
+ static const XERCESC_NS::DOMElement* getNearestAncestor(const XERCESC_NS::DOMNode* node, const std::string tagName);
static bool isDescendant(const XERCESC_NS::DOMNode* s1, const XERCESC_NS::DOMNode* s2);
diff --git a/src/uscxml/util/URL.cpp b/src/uscxml/util/URL.cpp
index 561b9aa..a76c772 100644
--- a/src/uscxml/util/URL.cpp
+++ b/src/uscxml/util/URL.cpp
@@ -144,9 +144,9 @@ URL URLImpl::resolveWithCWD(URLImpl* relative) {
#if WIN32
std::shared_ptr<URLImpl> cwdURL(new URLImpl(std::string(currPath)));
#else
- std::shared_ptr<URLImpl> cwdURL(new URLImpl(std::string("file://") + currPath + PATH_SEPERATOR));
+ std::shared_ptr<URLImpl> cwdURL(new URLImpl(std::string("file://") + currPath + PATH_SEPERATOR));
#endif
-
+
return resolve(relative, cwdURL.get());
}
diff --git a/src/uscxml/util/URL.h b/src/uscxml/util/URL.h
index dba8e3d..8127892 100644
--- a/src/uscxml/util/URL.h
+++ b/src/uscxml/util/URL.h
@@ -191,7 +191,7 @@ protected:
class USCXML_API URL {
public:
PIMPL_OPERATORS(URL);
-
+
URL(const std::string url) : _impl(new URLImpl(url)) {}
bool isAbsolute() {