summaryrefslogtreecommitdiffstats
path: root/src/uscxml/interpreter
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-07-19 14:41:34 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-07-19 14:41:34 (GMT)
commitaa341b878e6d4a2be8890ca5f890e46b87cf2d7d (patch)
treef35363f7ca5be90f5a4ca1d93210e96698f89d59 /src/uscxml/interpreter
parent9db80409b3ca048c4b404a43d2c224f374c0090a (diff)
downloaduscxml-aa341b878e6d4a2be8890ca5f890e46b87cf2d7d.zip
uscxml-aa341b878e6d4a2be8890ca5f890e46b87cf2d7d.tar.gz
uscxml-aa341b878e6d4a2be8890ca5f890e46b87cf2d7d.tar.bz2
Beautified code
Diffstat (limited to 'src/uscxml/interpreter')
-rw-r--r--src/uscxml/interpreter/BasicContentExecutor.cpp160
-rw-r--r--src/uscxml/interpreter/ContentExecutorImpl.h2
-rw-r--r--src/uscxml/interpreter/FastMicroStep.cpp150
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp14
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.h16
-rw-r--r--src/uscxml/interpreter/InterpreterMonitor.h574
6 files changed, 458 insertions, 458 deletions
diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp
index 9ea2b6a..87c2180 100644
--- a/src/uscxml/interpreter/BasicContentExecutor.cpp
+++ b/src/uscxml/interpreter/BasicContentExecutor.cpp
@@ -593,89 +593,89 @@ void BasicContentExecutor::processParams(std::multimap<std::string, Data>& param
paramMap.insert(make_pair(name, d));
}
}
-
+
Data BasicContentExecutor::elementAsData(XERCESC_NS::DOMElement* element, bool asExpression) {
- // element with expr
- if (HAS_ATTR(element, kXMLCharExpr)) {
- std::string expr = ATTR(element, kXMLCharExpr);
- if (_callbacks->isLegalDataValue(expr)) {
- return Data(expr, Data::INTERPRETED);
- } else {
- ERROR_EXECUTION_THROW2("Expression '" + expr + "' is not a legal data value", element);
- }
- }
-
- // element with external src - this ought to behave just as with child nodes below
- if (HAS_ATTR(element, kXMLCharSource)) {
-
- // remove any old child elements
- while(element->getFirstElementChild() != NULL) {
- element->removeChild(element->getFirstElementChild());
- }
-
- std::string src = ATTR(element, kXMLCharSource);
- URL url(ATTR(element, kXMLCharSource));
- if (!url.isAbsolute()) {
- url = URL::resolve(url, _callbacks->getBaseURL());
- }
- std::string content = url.getInContent();
-
- // append as XML?
- try {
- std::unique_ptr<XERCESC_NS::XercesDOMParser> parser(new XERCESC_NS::XercesDOMParser());
- parser->setValidationScheme(XERCESC_NS::XercesDOMParser::Val_Always);
- parser->setDoNamespaces(true);
- parser->useScanner(XERCESC_NS::XMLUni::fgWFXMLScanner);
-
- std::unique_ptr<XERCESC_NS::ErrorHandler> errHandler(new XERCESC_NS::HandlerBase());
- parser->setErrorHandler(errHandler.get());
-
- XERCESC_NS::MemBufInputSource is((XMLByte*)content.c_str(), content.size(), X("fake"));
- is.setPublicId(X(url));
-
- parser->parse(is);
- XERCESC_NS::DOMNode* newNode = element->getOwnerDocument()->importNode(parser->getDocument()->getDocumentElement(), true);
-
- // we need to save the DOM somewhere .. Data::adoptedDoc was not good enough
- element->appendChild(newNode);
- goto SOURCE_APPEND_DONE;
- } catch (...) {
- }
-
- // append as text (are we leaking?)
- XERCESC_NS::DOMText* textNode = element->getOwnerDocument()->createTextNode(X(content));
- element->appendChild(textNode);
- }
+ // element with expr
+ if (HAS_ATTR(element, kXMLCharExpr)) {
+ std::string expr = ATTR(element, kXMLCharExpr);
+ if (_callbacks->isLegalDataValue(expr)) {
+ return Data(expr, Data::INTERPRETED);
+ } else {
+ ERROR_EXECUTION_THROW2("Expression '" + expr + "' is not a legal data value", element);
+ }
+ }
+
+ // element with external src - this ought to behave just as with child nodes below
+ if (HAS_ATTR(element, kXMLCharSource)) {
+
+ // remove any old child elements
+ while(element->getFirstElementChild() != NULL) {
+ element->removeChild(element->getFirstElementChild());
+ }
+
+ std::string src = ATTR(element, kXMLCharSource);
+ URL url(ATTR(element, kXMLCharSource));
+ if (!url.isAbsolute()) {
+ url = URL::resolve(url, _callbacks->getBaseURL());
+ }
+ std::string content = url.getInContent();
+
+ // append as XML?
+ try {
+ std::unique_ptr<XERCESC_NS::XercesDOMParser> parser(new XERCESC_NS::XercesDOMParser());
+ parser->setValidationScheme(XERCESC_NS::XercesDOMParser::Val_Always);
+ parser->setDoNamespaces(true);
+ parser->useScanner(XERCESC_NS::XMLUni::fgWFXMLScanner);
+
+ std::unique_ptr<XERCESC_NS::ErrorHandler> errHandler(new XERCESC_NS::HandlerBase());
+ parser->setErrorHandler(errHandler.get());
+
+ XERCESC_NS::MemBufInputSource is((XMLByte*)content.c_str(), content.size(), X("fake"));
+ is.setPublicId(X(url));
+
+ parser->parse(is);
+ XERCESC_NS::DOMNode* newNode = element->getOwnerDocument()->importNode(parser->getDocument()->getDocumentElement(), true);
+
+ // we need to save the DOM somewhere .. Data::adoptedDoc was not good enough
+ element->appendChild(newNode);
+ goto SOURCE_APPEND_DONE;
+ } catch (...) {
+ }
+
+ // append as text (are we leaking?)
+ XERCESC_NS::DOMText* textNode = element->getOwnerDocument()->createTextNode(X(content));
+ element->appendChild(textNode);
+ }
SOURCE_APPEND_DONE:
- if (element->hasChildNodes()) {
- // XML elements e.g. for content with invoke
- std::list<DOMNode*> elementChildren = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, element);
- if (elementChildren.size() > 0) {
- // always return parent element, even with a single child node
- return Data(static_cast<DOMNode*>(element));
- }
-
- // expression in text element
- std::list<DOMNode*> textChildren = DOMUtils::filterChildType(DOMNode::TEXT_NODE, element);
- if (textChildren.size() > 0) {
- std::stringstream contentSS;
- for (auto textIter = textChildren.begin(); textIter != textChildren.end(); textIter++) {
- contentSS << X((*textIter)->getNodeValue());
- }
-
- try {
- Data d = _callbacks->getAsData(contentSS.str());
- if (!d.empty())
- return d;
- } catch(...) {}
-
- // anything else is considered verbatim - space normalize?
- return Data(spaceNormalize(contentSS.str()), Data::VERBATIM);
- }
- }
-
- return Data();
+ if (element->hasChildNodes()) {
+ // XML elements e.g. for content with invoke
+ std::list<DOMNode*> elementChildren = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, element);
+ if (elementChildren.size() > 0) {
+ // always return parent element, even with a single child node
+ return Data(static_cast<DOMNode*>(element));
+ }
+
+ // expression in text element
+ std::list<DOMNode*> textChildren = DOMUtils::filterChildType(DOMNode::TEXT_NODE, element);
+ if (textChildren.size() > 0) {
+ std::stringstream contentSS;
+ for (auto textIter = textChildren.begin(); textIter != textChildren.end(); textIter++) {
+ contentSS << X((*textIter)->getNodeValue());
+ }
+
+ try {
+ Data d = _callbacks->getAsData(contentSS.str());
+ if (!d.empty())
+ return d;
+ } catch(...) {}
+
+ // anything else is considered verbatim - space normalize?
+ return Data(spaceNormalize(contentSS.str()), Data::VERBATIM);
+ }
+ }
+
+ return Data();
}
}
diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h
index 0c080ca..8221591 100644
--- a/src/uscxml/interpreter/ContentExecutorImpl.h
+++ b/src/uscxml/interpreter/ContentExecutorImpl.h
@@ -62,7 +62,7 @@ public:
virtual Data evalAsData(const std::string& expr) = 0;
virtual void eval(const std::string& expr) = 0;
virtual Data getAsData(const std::string& expr) = 0;
- virtual bool isLegalDataValue(const std::string& expr) = 0;
+ virtual bool isLegalDataValue(const std::string& expr) = 0;
virtual void assign(const std::string& location, const Data& data, const std::map<std::string, std::string>& attrs) = 0;
diff --git a/src/uscxml/interpreter/FastMicroStep.cpp b/src/uscxml/interpreter/FastMicroStep.cpp
index 1258279..78aada9 100644
--- a/src/uscxml/interpreter/FastMicroStep.cpp
+++ b/src/uscxml/interpreter/FastMicroStep.cpp
@@ -511,7 +511,7 @@ COMPLETION_STABLISHED:
// std::list<Transition*> transSpontaneous;
// std::list<Transition*> transEventful;
-
+
for (i = 0; i < _transitions.size(); i++) {
_transitions[i] = new Transition(i);
_transitions[i]->element = tmp.front();
@@ -583,9 +583,9 @@ TARGET_SET_ESTABLISHED:
if (!HAS_ATTR(_transitions[i]->element, kXMLCharEvent)) {
_transitions[i]->type |= USCXML_TRANS_SPONTANEOUS;
// transSpontaneous.push_back(_transitions[i]);
- } else {
+ } else {
// transEventful.push_back(_transitions[i]);
- }
+ }
if (iequals(TAGNAME_CAST(_transitions[i]->element->getParentNode()), _xmlPrefix.str() + "history")) {
_transitions[i]->type |= USCXML_TRANS_HISTORY;
@@ -618,81 +618,81 @@ TARGET_SET_ESTABLISHED:
* This bound by cache locality!
* Before you change anything, do benchmark!
*/
-
+
#if 0
#define exit1 _exitSets[t1->postFixOrder]
#define exit2 _exitSets[t2->postFixOrder]
- for (size_t set = 0; set < 2; set++) {
- std::list<Transition*>::const_iterator transBegin;
- std::list<Transition*>::const_iterator transEnd;
- if (set == 0) {
- transBegin = transEventful.begin();
- transEnd = transEventful.end();
- } else {
- transBegin = transSpontaneous.begin();
- transEnd = transSpontaneous.end();
- }
-
- for (auto t1Iter = transBegin; t1Iter != transEnd; t1Iter++) {
- Transition* t1 = *t1Iter;
- auto anc1 = _states[t1->source]->ancestors;
- const uint32_t source1 = t1->source;
-
- for (auto t2Iter = t1Iter; t2Iter != transEnd; t2Iter++) {
- Transition* t2 = *t2Iter;
-
- if (exit1.first == 0 && exit2.first == 0) {
- goto COMPATIBLE_TRANS;
- }
-
- if (exit1.first <= exit2.first && exit1.second >= exit2.first) {
- goto CONFLICTING_TRANS;
- }
-
- if (exit2.first <= exit1.first && exit2.second >= exit1.first) {
- goto CONFLICTING_TRANS;
- }
-
- COMPATIBLE_TRANS:
- if (t2->source == source1) {
- goto CONFLICTING_TRANS;
- }
-
- if (anc1[t2->source]) {
- goto CONFLICTING_TRANS;
- }
-
- if (_states[t2->source]->ancestors[source1]) {
- goto CONFLICTING_TRANS;
- }
-
- t1->conflicts[t2->postFixOrder] = false;
- // _transitions[j]->conflicts[i] = false;
- continue;
-
- CONFLICTING_TRANS:
- t1->conflicts[t2->postFixOrder] = true;
- // _transitions[j]->conflicts[i] = true;
-
- continue;
-
- }
- }
-
- for (auto t1Iter = transBegin; t1Iter != transEnd; t1Iter++) {
- Transition* t1 = *t1Iter;
- // conflicts matrix is symmetric
- for (auto t2Iter = transBegin; t2Iter != t1Iter; t2Iter++) {
- Transition* t2 = *t2Iter;
-
- t1->conflicts[t2->postFixOrder] = t2->conflicts[t1->postFixOrder];
- }
- }
-
- }
-
-
+ for (size_t set = 0; set < 2; set++) {
+ std::list<Transition*>::const_iterator transBegin;
+ std::list<Transition*>::const_iterator transEnd;
+ if (set == 0) {
+ transBegin = transEventful.begin();
+ transEnd = transEventful.end();
+ } else {
+ transBegin = transSpontaneous.begin();
+ transEnd = transSpontaneous.end();
+ }
+
+ for (auto t1Iter = transBegin; t1Iter != transEnd; t1Iter++) {
+ Transition* t1 = *t1Iter;
+ auto anc1 = _states[t1->source]->ancestors;
+ const uint32_t source1 = t1->source;
+
+ for (auto t2Iter = t1Iter; t2Iter != transEnd; t2Iter++) {
+ Transition* t2 = *t2Iter;
+
+ if (exit1.first == 0 && exit2.first == 0) {
+ goto COMPATIBLE_TRANS;
+ }
+
+ if (exit1.first <= exit2.first && exit1.second >= exit2.first) {
+ goto CONFLICTING_TRANS;
+ }
+
+ if (exit2.first <= exit1.first && exit2.second >= exit1.first) {
+ goto CONFLICTING_TRANS;
+ }
+
+COMPATIBLE_TRANS:
+ if (t2->source == source1) {
+ goto CONFLICTING_TRANS;
+ }
+
+ if (anc1[t2->source]) {
+ goto CONFLICTING_TRANS;
+ }
+
+ if (_states[t2->source]->ancestors[source1]) {
+ goto CONFLICTING_TRANS;
+ }
+
+ t1->conflicts[t2->postFixOrder] = false;
+ // _transitions[j]->conflicts[i] = false;
+ continue;
+
+CONFLICTING_TRANS:
+ t1->conflicts[t2->postFixOrder] = true;
+ // _transitions[j]->conflicts[i] = true;
+
+ continue;
+
+ }
+ }
+
+ for (auto t1Iter = transBegin; t1Iter != transEnd; t1Iter++) {
+ Transition* t1 = *t1Iter;
+ // conflicts matrix is symmetric
+ for (auto t2Iter = transBegin; t2Iter != t1Iter; t2Iter++) {
+ Transition* t2 = *t2Iter;
+
+ t1->conflicts[t2->postFixOrder] = t2->conflicts[t1->postFixOrder];
+ }
+ }
+
+ }
+
+
#else
#define anc1 _states[_transitions[i]->source]->ancestors
#define exit1 _exitSets[i]
@@ -748,7 +748,7 @@ CONFLICTING_TRANS:
}
}
#endif
-
+
// initialize bitarrays for step()
_exitSet = boost::dynamic_bitset<BITSET_BLOCKTYPE>(_states.size(), false);
_entrySet = boost::dynamic_bitset<BITSET_BLOCKTYPE>(_states.size(), false);
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
index 1caa3f0..185ad75 100644
--- a/src/uscxml/interpreter/InterpreterImpl.cpp
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -103,8 +103,8 @@ InterpreterImpl::~InterpreterImpl() {
if (_document)
delete _document;
- if (_lambdaMonitor)
- delete _lambdaMonitor;
+ if (_lambdaMonitor)
+ delete _lambdaMonitor;
{
std::lock_guard<std::recursive_mutex> lock(_instanceMutex);
@@ -626,11 +626,11 @@ void InterpreterImpl::enqueueAtParent(const Event& event) {
}
LambdaMonitor& InterpreterImpl::on() {
- if (_lambdaMonitor == NULL) {
- _lambdaMonitor = new LambdaMonitor();
- addMonitor(_lambdaMonitor);
- }
- return *_lambdaMonitor;
+ if (_lambdaMonitor == NULL) {
+ _lambdaMonitor = new LambdaMonitor();
+ addMonitor(_lambdaMonitor);
+ }
+ return *_lambdaMonitor;
}
}
diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h
index 1f87fd2..cb31988 100644
--- a/src/uscxml/interpreter/InterpreterImpl.h
+++ b/src/uscxml/interpreter/InterpreterImpl.h
@@ -196,9 +196,9 @@ public:
return _dataModel.getAsData(expr);
}
- virtual bool isLegalDataValue(const std::string& expr) {
- return _dataModel.isLegalDataValue(expr);
- }
+ virtual bool isLegalDataValue(const std::string& expr) {
+ return _dataModel.isLegalDataValue(expr);
+ }
virtual void assign(const std::string& location, const Data& data, const std::map<std::string, std::string>& attrs);
@@ -273,13 +273,13 @@ public:
return _document;
}
- LambdaMonitor& on();
-
+ LambdaMonitor& on();
+
protected:
static void addInstance(std::shared_ptr<InterpreterImpl> instance);
-
- LambdaMonitor* _lambdaMonitor = NULL;
-
+
+ LambdaMonitor* _lambdaMonitor = NULL;
+
Binding _binding;
ActionLanguage _al;
diff --git a/src/uscxml/interpreter/InterpreterMonitor.h b/src/uscxml/interpreter/InterpreterMonitor.h
index ed62675..64c281c 100644
--- a/src/uscxml/interpreter/InterpreterMonitor.h
+++ b/src/uscxml/interpreter/InterpreterMonitor.h
@@ -66,46 +66,46 @@ public:
virtual ~InterpreterMonitor() {}
virtual void beforeProcessingEvent(const std::string& sessionId,
- const Event& event) {}
+ const Event& event) {}
virtual void beforeMicroStep(const std::string& sessionId) {}
virtual void beforeExitingState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {}
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {}
virtual void afterExitingState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {}
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {}
virtual void beforeExecutingContent(const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent) {}
+ const XERCESC_NS::DOMElement* execContent) {}
virtual void afterExecutingContent(const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent) {}
+ const XERCESC_NS::DOMElement* execContent) {}
virtual void beforeUninvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {}
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {}
virtual void afterUninvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {}
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {}
virtual void beforeTakingTransition(const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition) {}
+ const XERCESC_NS::DOMElement* transition) {}
virtual void afterTakingTransition(const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition) {}
+ const XERCESC_NS::DOMElement* transition) {}
virtual void beforeEnteringState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {}
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {}
virtual void afterEnteringState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {}
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {}
virtual void beforeInvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {}
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {}
virtual void afterInvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {}
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {}
virtual void afterMicroStep(const std::string& sessionId) {}
virtual void onStableConfiguration(const std::string& sessionId) {}
@@ -114,7 +114,7 @@ public:
virtual void afterCompletion(const std::string& sessionId) {}
virtual void reportIssue(const std::string& sessionId,
- const InterpreterIssue& issue) {}
+ const InterpreterIssue& issue) {}
void copyToInvokers(bool copy) {
_copyToInvokers = copy;
@@ -149,273 +149,273 @@ protected:
class USCXML_API LambdaMonitor : public InterpreterMonitor {
public:
- void processEvent(std::function<void (const std::string& sessionId,
- const Event& event)> callback) {
- _beforeProcessingEvent = callback;
- }
-
-
- void microStep(std::function<void (const std::string& sessionId)> callback,
- bool after = false) {
- if (after) {
- _afterMicroStep = callback;
- } else {
- _beforeMicroStep = callback;
- }
-
- }
-
- void exitState(std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> callback,
- bool after = false) {
- if (after) {
- _afterExitingState = callback;
- } else {
- _beforeExitingState = callback;
- }
- }
-
- void executeContent(std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent)> callback,
- bool after = false) {
- if (after) {
- _afterExecutingContent = callback;
- } else {
- _beforeExecutingContent = callback;
- }
- }
-
- void uninvoke(std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> callback,
- bool after = false) {
- if (after) {
- _afterUninvoking = callback;
- } else {
- _beforeUninvoking = callback;
- }
- }
-
- void transition(std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition)> callback,
- bool after = false) {
- if (after) {
- _afterTakingTransition = callback;
- } else {
- _beforeTakingTransition = callback;
- }
- }
-
- void enterState(std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> callback,
- bool after = false) {
- _beforeEnteringState = callback;
- if (after) {
- _afterEnteringState = callback;
- } else {
- _beforeEnteringState = callback;
- }
-
- }
-
- void invoke(std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> callback,
- bool after = false) {
- if (after) {
- _afterInvoking = callback;
- } else {
- _beforeInvoking = callback;
- }
- }
-
- void stableConfiguration(std::function<void (const std::string& sessionId)> callback) {
- _onStableConfiguration = callback;
- }
-
- void completion(std::function<void (const std::string& sessionId)> callback,
- bool after = false) {
- if (after) {
- _afterCompletion = callback;
- } else {
- _beforeCompletion = callback;
- }
-
- }
-
- void reportIssue(std::function<void (const std::string& sessionId,
- const InterpreterIssue& issue)> callback) {
- _reportIssue = callback;
- }
+ void processEvent(std::function<void (const std::string& sessionId,
+ const Event& event)> callback) {
+ _beforeProcessingEvent = callback;
+ }
+
+
+ void microStep(std::function<void (const std::string& sessionId)> callback,
+ bool after = false) {
+ if (after) {
+ _afterMicroStep = callback;
+ } else {
+ _beforeMicroStep = callback;
+ }
+
+ }
+
+ void exitState(std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> callback,
+ bool after = false) {
+ if (after) {
+ _afterExitingState = callback;
+ } else {
+ _beforeExitingState = callback;
+ }
+ }
+
+ void executeContent(std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* execContent)> callback,
+ bool after = false) {
+ if (after) {
+ _afterExecutingContent = callback;
+ } else {
+ _beforeExecutingContent = callback;
+ }
+ }
+
+ void uninvoke(std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> callback,
+ bool after = false) {
+ if (after) {
+ _afterUninvoking = callback;
+ } else {
+ _beforeUninvoking = callback;
+ }
+ }
+
+ void transition(std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* transition)> callback,
+ bool after = false) {
+ if (after) {
+ _afterTakingTransition = callback;
+ } else {
+ _beforeTakingTransition = callback;
+ }
+ }
+
+ void enterState(std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> callback,
+ bool after = false) {
+ _beforeEnteringState = callback;
+ if (after) {
+ _afterEnteringState = callback;
+ } else {
+ _beforeEnteringState = callback;
+ }
+
+ }
+
+ void invoke(std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> callback,
+ bool after = false) {
+ if (after) {
+ _afterInvoking = callback;
+ } else {
+ _beforeInvoking = callback;
+ }
+ }
+
+ void stableConfiguration(std::function<void (const std::string& sessionId)> callback) {
+ _onStableConfiguration = callback;
+ }
+
+ void completion(std::function<void (const std::string& sessionId)> callback,
+ bool after = false) {
+ if (after) {
+ _afterCompletion = callback;
+ } else {
+ _beforeCompletion = callback;
+ }
+
+ }
+
+ void reportIssue(std::function<void (const std::string& sessionId,
+ const InterpreterIssue& issue)> callback) {
+ _reportIssue = callback;
+ }
protected:
-
- std::function<void (const std::string& sessionId,
- const Event& event)> _beforeProcessingEvent;
-
- std::function<void (const std::string& sessionId)> _beforeMicroStep;
-
- std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> _beforeExitingState;
-
- std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> _afterExitingState;
-
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent)> _beforeExecutingContent;
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent)> _afterExecutingContent;
-
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> _beforeUninvoking;
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> _afterUninvoking;
-
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition)> _beforeTakingTransition;
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition)> _afterTakingTransition;
-
- std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> _beforeEnteringState;
- std::function<void (const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state)> _afterEnteringState;
-
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> _beforeInvoking;
- std::function<void (const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid)> _afterInvoking;
-
- std::function<void (const std::string& sessionId)> _afterMicroStep;
- std::function<void (const std::string& sessionId)> _onStableConfiguration;
-
- std::function<void (const std::string& sessionId)> _beforeCompletion;
- std::function<void (const std::string& sessionId)> _afterCompletion;
-
- std::function<void (const std::string& sessionId,
- const InterpreterIssue& issue)> _reportIssue;
-
-
-
- void beforeProcessingEvent(const std::string& sessionId,
- const Event& event) {
- if (_beforeProcessingEvent)
- _beforeProcessingEvent(sessionId, event);
- }
- void beforeMicroStep(const std::string& sessionId) {
- if (_beforeMicroStep)
- _beforeMicroStep(sessionId);
- }
-
- void beforeExitingState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {
- if (_beforeExitingState)
- _beforeExitingState(sessionId, stateName, state);
- }
-
- void afterExitingState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {
- if (_afterExitingState)
- _afterExitingState(sessionId, stateName, state);
- }
-
- void beforeExecutingContent(const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent) {
- if (_beforeExecutingContent)
- _beforeExecutingContent(sessionId, execContent);
- }
- void afterExecutingContent(const std::string& sessionId,
- const XERCESC_NS::DOMElement* execContent) {
- if (_afterExecutingContent)
- _afterExecutingContent(sessionId, execContent);
-
- }
-
- void beforeUninvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {
- if (_beforeUninvoking)
- _beforeUninvoking(sessionId, invokeElem, invokeid);
- }
- void afterUninvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {
- if (_afterUninvoking)
- _afterUninvoking(sessionId, invokeElem, invokeid);
- }
-
- void beforeTakingTransition(const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition) {
- if (_beforeTakingTransition)
- _beforeTakingTransition(sessionId, transition);
- }
- void afterTakingTransition(const std::string& sessionId,
- const XERCESC_NS::DOMElement* transition) {
- if (_afterTakingTransition)
- _afterTakingTransition(sessionId, transition);
- }
-
- void beforeEnteringState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {
- if (_beforeEnteringState)
- _beforeEnteringState(sessionId, stateName, state);
- }
- void afterEnteringState(const std::string& sessionId,
- const std::string& stateName,
- const XERCESC_NS::DOMElement* state) {
- if (_afterEnteringState)
- _afterEnteringState(sessionId, stateName, state);
- }
-
- void beforeInvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {
- if (_beforeInvoking)
- _beforeInvoking(sessionId, invokeElem, invokeid);
- }
- void afterInvoking(const std::string& sessionId,
- const XERCESC_NS::DOMElement* invokeElem,
- const std::string& invokeid) {
- if (_afterInvoking)
- _afterInvoking(sessionId, invokeElem, invokeid);
- }
-
- void afterMicroStep(const std::string& sessionId) {
- if (_afterMicroStep)
- _afterMicroStep(sessionId);
- }
- void onStableConfiguration(const std::string& sessionId) {
- if (_onStableConfiguration)
- _onStableConfiguration(sessionId);
- }
-
- void beforeCompletion(const std::string& sessionId) {
- if (_beforeCompletion)
- _beforeCompletion(sessionId);
- }
- void afterCompletion(const std::string& sessionId) {
- if (_afterCompletion)
- _afterCompletion(sessionId);
- }
-
- void reportIssue(const std::string& sessionId,
- const InterpreterIssue& issue) {
- if (_reportIssue)
- _reportIssue(sessionId, issue);
- }
+
+ std::function<void (const std::string& sessionId,
+ const Event& event)> _beforeProcessingEvent;
+
+ std::function<void (const std::string& sessionId)> _beforeMicroStep;
+
+ std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> _beforeExitingState;
+
+ std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> _afterExitingState;
+
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* execContent)> _beforeExecutingContent;
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* execContent)> _afterExecutingContent;
+
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> _beforeUninvoking;
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> _afterUninvoking;
+
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* transition)> _beforeTakingTransition;
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* transition)> _afterTakingTransition;
+
+ std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> _beforeEnteringState;
+ std::function<void (const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state)> _afterEnteringState;
+
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> _beforeInvoking;
+ std::function<void (const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid)> _afterInvoking;
+
+ std::function<void (const std::string& sessionId)> _afterMicroStep;
+ std::function<void (const std::string& sessionId)> _onStableConfiguration;
+
+ std::function<void (const std::string& sessionId)> _beforeCompletion;
+ std::function<void (const std::string& sessionId)> _afterCompletion;
+
+ std::function<void (const std::string& sessionId,
+ const InterpreterIssue& issue)> _reportIssue;
+
+
+
+ void beforeProcessingEvent(const std::string& sessionId,
+ const Event& event) {
+ if (_beforeProcessingEvent)
+ _beforeProcessingEvent(sessionId, event);
+ }
+ void beforeMicroStep(const std::string& sessionId) {
+ if (_beforeMicroStep)
+ _beforeMicroStep(sessionId);
+ }
+
+ void beforeExitingState(const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {
+ if (_beforeExitingState)
+ _beforeExitingState(sessionId, stateName, state);
+ }
+
+ void afterExitingState(const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {
+ if (_afterExitingState)
+ _afterExitingState(sessionId, stateName, state);
+ }
+
+ void beforeExecutingContent(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* execContent) {
+ if (_beforeExecutingContent)
+ _beforeExecutingContent(sessionId, execContent);
+ }
+ void afterExecutingContent(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* execContent) {
+ if (_afterExecutingContent)
+ _afterExecutingContent(sessionId, execContent);
+
+ }
+
+ void beforeUninvoking(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {
+ if (_beforeUninvoking)
+ _beforeUninvoking(sessionId, invokeElem, invokeid);
+ }
+ void afterUninvoking(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {
+ if (_afterUninvoking)
+ _afterUninvoking(sessionId, invokeElem, invokeid);
+ }
+
+ void beforeTakingTransition(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* transition) {
+ if (_beforeTakingTransition)
+ _beforeTakingTransition(sessionId, transition);
+ }
+ void afterTakingTransition(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* transition) {
+ if (_afterTakingTransition)
+ _afterTakingTransition(sessionId, transition);
+ }
+
+ void beforeEnteringState(const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {
+ if (_beforeEnteringState)
+ _beforeEnteringState(sessionId, stateName, state);
+ }
+ void afterEnteringState(const std::string& sessionId,
+ const std::string& stateName,
+ const XERCESC_NS::DOMElement* state) {
+ if (_afterEnteringState)
+ _afterEnteringState(sessionId, stateName, state);
+ }
+
+ void beforeInvoking(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {
+ if (_beforeInvoking)
+ _beforeInvoking(sessionId, invokeElem, invokeid);
+ }
+ void afterInvoking(const std::string& sessionId,
+ const XERCESC_NS::DOMElement* invokeElem,
+ const std::string& invokeid) {
+ if (_afterInvoking)
+ _afterInvoking(sessionId, invokeElem, invokeid);
+ }
+
+ void afterMicroStep(const std::string& sessionId) {
+ if (_afterMicroStep)
+ _afterMicroStep(sessionId);
+ }
+ void onStableConfiguration(const std::string& sessionId) {
+ if (_onStableConfiguration)
+ _onStableConfiguration(sessionId);
+ }
+
+ void beforeCompletion(const std::string& sessionId) {
+ if (_beforeCompletion)
+ _beforeCompletion(sessionId);
+ }
+ void afterCompletion(const std::string& sessionId) {
+ if (_afterCompletion)
+ _afterCompletion(sessionId);
+ }
+
+ void reportIssue(const std::string& sessionId,
+ const InterpreterIssue& issue) {
+ if (_reportIssue)
+ _reportIssue(sessionId, issue);
+ }
};
}