diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/swig/php/test.php | 28 | ||||
-rw-r--r-- | src/uscxml/Message.h | 4 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/bindings/swig/php/test.php b/src/bindings/swig/php/test.php index 6896ab0..d87856f 100644 --- a/src/bindings/swig/php/test.php +++ b/src/bindings/swig/php/test.php @@ -41,16 +41,17 @@ class MyMonitor extends InterpreterMonitor { $monitor = new MyMonitor(); -// $interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-ecmascript.scxml'); -// $interpreter->addMonitor($monitor); -// $interpreter->interpret(); +// run interpreter in blocking mode +$interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-ecmascript.scxml'); +$interpreter->addMonitor($monitor); +$interpreter->interpret(); -$interpreter = Interpreter::fromURI('/Users/sradomski/Documents/TK/Code/uscxml/test/samples/uscxml/test-invoked.scxml'); +// start interpreter as a thread +$interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-invoked.scxml'); $parentQueue = new ParentQueue(); $interpreter->setParentQueue($parentQueue); -//$interpreter->start(); -$interpreter->interpret(); -exit(); +$interpreter->start(); + while($interpreter->isRunning()) { $event = $parentQueue->pop(); print("Name: " . $event->getName() . "\n"); @@ -59,12 +60,21 @@ while($interpreter->isRunning()) { print("Namelist: \n"); $namelist = $event->getNameList(); print("\tSize: ". $namelist->size() ."\n"); - $keys = $event->getNameListKeys(); - for ($i = 0; $i < $keys->size(); $i++) { print("\t" . $namelist->get($keys->get($i)) . "\n"); } + + print("Params: \n"); + $params = $event->getParams(); + print("\tSize: ". $params->size() ."\n"); + $keys = $event->getParamKeys(); + for ($i = 0; $i < $keys->size(); $i++) { + $paramList = $params->get($keys->get($i)); + for ($j = 0; $j < $paramList->size(); $j++) { + print("\t" . $paramList->get($i) . "\n"); + } + } } diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h index 006d515..2a49264 100644 --- a/src/uscxml/Message.h +++ b/src/uscxml/Message.h @@ -155,7 +155,7 @@ public: /// TODO: Do we want to set namelist and params as well? std::map<std::string, std::string> getNameList() { return namelist; } - virtual const std::vector<std::string> getNameListKeys() { + const std::vector<std::string> getNameListKeys() { std::set<std::string> keys; namelist_t::const_iterator nameListIter = namelist.begin(); while (nameListIter != namelist.end()) { @@ -239,7 +239,7 @@ public: /// TODO: Do we want to set namelist and params as well? std::map<std::string, std::string> getNameList() { return namelist; } - virtual const std::vector<std::string> getNameListKeys() { + const std::vector<std::string> getNameListKeys() { std::set<std::string> keys; namelist_t::const_iterator nameListIter = namelist.begin(); while (nameListIter != namelist.end()) { |