diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-07-13 23:15:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 23:15:57 (GMT) |
commit | 4a9b4978eca21c01e45bdea56ee97285b8ca11a7 (patch) | |
tree | 40a8f92a0abd081f59a8aacc4b726dabf3c8f2f5 /test/src/test-snippets.cpp | |
parent | f5198b3027a9a1d1de0aa92b2e62e13d0dc6f47d (diff) | |
parent | 04b04aa6624caf73ffe4fc33f918e7f48b27da37 (diff) | |
download | uscxml-4a9b4978eca21c01e45bdea56ee97285b8ca11a7.zip uscxml-4a9b4978eca21c01e45bdea56ee97285b8ca11a7.tar.gz uscxml-4a9b4978eca21c01e45bdea56ee97285b8ca11a7.tar.bz2 |
Merge pull request #162 from tklab-tud/sradomski
LambdaMonitors and prepared use-case examples
Diffstat (limited to 'test/src/test-snippets.cpp')
-rw-r--r-- | test/src/test-snippets.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/src/test-snippets.cpp b/test/src/test-snippets.cpp index f26b730..5eb680f 100644 --- a/test/src/test-snippets.cpp +++ b/test/src/test-snippets.cpp @@ -9,6 +9,8 @@ #include "uscxml/Interpreter.h" #include "uscxml/interpreter/LoggingImpl.h" +#include <iostream> + using namespace uscxml; void microstep_snippet() { @@ -31,9 +33,30 @@ void microstep_snippet() { } +void lambda_snippet() { + InterpreterState state = uscxml::USCXML_UNDEF; + Interpreter scxml = Interpreter::fromURL("https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml"); + + scxml.on().enterState([](const std::string& sessionId, + const std::string& stateName, + const xercesc_3_1::DOMElement* state) { + std::cout << "Entered " << stateName << std::endl; + }); + + scxml.on().exitState([](const std::string& sessionId, + const std::string& stateName, + const xercesc_3_1::DOMElement* state) { + std::cout << "Exited " << stateName << std::endl; + }); + + + while((state = scxml.step()) != uscxml::USCXML_FINISHED) {} + +} + int main(int argc, char** argv) { try { - Logger::getDefault().log(USCXML_FATAL) << "Foo!" << " BAR?" << std::endl; + lambda_snippet(); microstep_snippet(); } catch (...) { exit(EXIT_FAILURE); |