summaryrefslogtreecommitdiffstats
path: root/src/uscxml/interpreter
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-06 21:17:13 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-06 21:17:13 (GMT)
commit1e6ba139ac12c688f025745812d381915775b1fb (patch)
tree1d49070eddd4502ec6aa25a769ab7c47d04a1c30 /src/uscxml/interpreter
parent139439f0675ec05e936fd4297086462037cd618e (diff)
downloaduscxml-1e6ba139ac12c688f025745812d381915775b1fb.zip
uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.gz
uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.bz2
See detailled log
Added new revised W3C tests Hide Interpreter via PIMPL Implemented SCXMLIOProcessor
Diffstat (limited to 'src/uscxml/interpreter')
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp50
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft7.h2
3 files changed, 27 insertions, 27 deletions
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index 2f05be9..3c97805 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -19,8 +19,8 @@ void InterpreterDraft6::interpret() {
}
// dump();
- if (_sessionId.length() == 0)
- _sessionId = getUUID();
+ // just make sure we have a session id
+ assert(_sessionId.length() > 0);
std::string datamodelName;
if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "datamodel"))
@@ -137,7 +137,7 @@ void InterpreterDraft6::mainEventLoop() {
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->beforeMicroStep(this);
+ (*monIter)->beforeMicroStep(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling beforeMicroStep on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -165,7 +165,7 @@ void InterpreterDraft6::mainEventLoop() {
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->beforeTakingTransitions(this, enabledTransitions);
+ (*monIter)->beforeTakingTransitions(shared_from_this(), enabledTransitions);
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling beforeTakingTransitions on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -197,7 +197,7 @@ void InterpreterDraft6::mainEventLoop() {
// if (!_sendQueue || _sendQueue->isEmpty()) {
while(monIter != _monitors.end()) {
try {
- (*monIter)->onStableConfiguration(this);
+ (*monIter)->onStableConfiguration(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling onStableConfiguration on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -276,7 +276,7 @@ EXIT_INTERPRETER:
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->beforeCompletion(this);
+ (*monIter)->beforeCompletion(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling beforeCompletion on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -287,7 +287,7 @@ EXIT_INTERPRETER:
exitInterpreter();
if (_sendQueue) {
- std::map<std::string, std::pair<Interpreter*, SendRequest> >::iterator sendIter = _sendIds.begin();
+ std::map<std::string, std::pair<InterpreterImpl*, SendRequest> >::iterator sendIter = _sendIds.begin();
while(sendIter != _sendIds.end()) {
_sendQueue->cancelEvent(sendIter->first);
sendIter++;
@@ -297,7 +297,7 @@ EXIT_INTERPRETER:
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->afterCompletion(this);
+ (*monIter)->afterCompletion(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling afterCompletion on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -343,10 +343,10 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const
states.push_back(parent);
}
}
- LOOP:
+LOOP:
index++;
}
-
+
#if 0
std::cout << "Enabled transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
@@ -354,7 +354,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const
}
std::cout << std::endl;
#endif
-
+
enabledTransitions = filterPreempted(enabledTransitions);
return enabledTransitions;
}
@@ -373,9 +373,9 @@ bool InterpreterDraft6::isEnabledTransition(const Node<std::string>& transition,
} else {
return false;
}
-
+
std::vector<std::string> eventNames = tokenizeIdRefs(eventName);
-
+
if (eventNames.size() > 0 && hasConditionMatch(transition)) {
std::vector<std::string>::iterator eventIter = eventNames.begin();
while(eventIter != eventNames.end()) {
@@ -387,7 +387,7 @@ bool InterpreterDraft6::isEnabledTransition(const Node<std::string>& transition,
}
return false;
}
-
+
Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitions() {
Arabica::XPath::NodeSet<std::string> enabledTransitions;
@@ -423,7 +423,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitio
states.push_back(parent);
}
}
- LOOP:
+LOOP:
index++;
}
@@ -451,7 +451,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::filterPreempted(const Ar
if (isPreemptingTransition(t2, t)) {
#if 0
std::cout << "#####" << std::endl << "Transition " << std::endl
- << t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl;
+ << t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl;
#endif
goto LOOP;
}
@@ -500,7 +500,7 @@ bool InterpreterDraft6::isCrossingBounds(const Node<std::string>& transition) {
bool InterpreterDraft6::isWithinParallel(const Node<std::string>& transition) {
if (isTargetless(transition))
return false;
-
+
Node<std::string> source;
if (HAS_ATTR(transition, "type") && boost::iequals(ATTR(transition, "type"), "internal")) {
source = getSourceState(transition);
@@ -509,7 +509,7 @@ bool InterpreterDraft6::isWithinParallel(const Node<std::string>& transition) {
}
NodeSet<std::string> targets = getTargetStates(transition);
targets.push_back(source);
-
+
Node<std::string> lcpa = findLCPA(targets);
return lcpa;
}
@@ -526,7 +526,7 @@ Node<std::string> InterpreterDraft6::findLCPA(const Arabica::XPath::NodeSet<std:
}
ancestor = ancestors[i];
break;
- NEXT_ANCESTOR:
+NEXT_ANCESTOR:
;
}
return ancestor;
@@ -619,7 +619,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e
for (int j = 0; j < _configuration.size(); j++) {
if (isDescendant(_configuration[j], ancestor))
statesToExit.push_back(_configuration[j]);
- }
+ }
}
}
// remove statesToExit from _statesToInvoke
@@ -642,11 +642,11 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e
}
std::cout << std::endl;
#endif
-
+
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->beforeExitingStates(this, statesToExit);
+ (*monIter)->beforeExitingStates(shared_from_this(), statesToExit);
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling beforeExitingStates on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -707,7 +707,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->afterExitingStates(this);
+ (*monIter)->afterExitingStates(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling afterExitingStates on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -824,7 +824,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>&
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->beforeEnteringStates(this, statesToEnter);
+ (*monIter)->beforeEnteringStates(shared_from_this(), statesToEnter);
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling beforeEnteringStates on monitors: " << std::endl << e << std::endl;
} catch (...) {
@@ -891,7 +891,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>&
monIter = _monitors.begin();
while(monIter != _monitors.end()) {
try {
- (*monIter)->afterEnteringStates(this);
+ (*monIter)->afterEnteringStates(shared_from_this());
} catch (Event e) {
LOG(ERROR) << "Syntax error when calling afterEnteringStates on monitors: " << std::endl << e << std::endl;
} catch (...) {
diff --git a/src/uscxml/interpreter/InterpreterDraft6.h b/src/uscxml/interpreter/InterpreterDraft6.h
index 9ecfd3b..36dedce 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.h
+++ b/src/uscxml/interpreter/InterpreterDraft6.h
@@ -5,7 +5,7 @@
namespace uscxml {
-class InterpreterDraft6 : public Interpreter {
+class InterpreterDraft6 : public InterpreterImpl {
protected:
void interpret();
void mainEventLoop();
diff --git a/src/uscxml/interpreter/InterpreterDraft7.h b/src/uscxml/interpreter/InterpreterDraft7.h
index 1dc9350..7600041 100644
--- a/src/uscxml/interpreter/InterpreterDraft7.h
+++ b/src/uscxml/interpreter/InterpreterDraft7.h
@@ -5,7 +5,7 @@
namespace uscxml {
-class InterpreterDraft7 : public Interpreter {
+class InterpreterDraft7 : public InterpreterImpl {
void interpret();
void mainEventLoop();
void exitInterpreter();