summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-27 16:23:58 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-27 16:23:58 (GMT)
commitf11664454a92cd6df193f665fa8d7f2f81d2e06d (patch)
treefcc04bc9f43daac54a95e9dc8942262b995689f9 /src
parentc0e29f9d4574be340d23c88605bf8868b166f718 (diff)
downloaduscxml-f11664454a92cd6df193f665fa8d7f2f81d2e06d.zip
uscxml-f11664454a92cd6df193f665fa8d7f2f81d2e06d.tar.gz
uscxml-f11664454a92cd6df193f665fa8d7f2f81d2e06d.tar.bz2
Some final touches on PHP API
Diffstat (limited to 'src')
-rw-r--r--src/bindings/swig/php/test.php28
-rw-r--r--src/uscxml/Message.h4
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()) {