summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-30 17:31:50 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-30 17:31:50 (GMT)
commit5cdc1f8ec070fc3b8d03bde36a1854e7291790a2 (patch)
treea13531d9ce29693e5c3b4c8f6396dfac4bbf4290 /src
parentc8f8923484cbc99eff1e3c0b703568b243f3728b (diff)
downloaduscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.zip
uscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.tar.gz
uscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.tar.bz2
Interpreter cannot be abstract for PHP wrappers to work
Diffstat (limited to 'src')
-rw-r--r--src/bindings/swig/php/uscxmlNativePHP.php58
-rw-r--r--src/uscxml/Interpreter.cpp11
-rw-r--r--src/uscxml/Interpreter.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft7.cpp9
4 files changed, 44 insertions, 36 deletions
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php
index 85cef6c..7a1b9f8 100644
--- a/src/bindings/swig/php/uscxmlNativePHP.php
+++ b/src/bindings/swig/php/uscxmlNativePHP.php
@@ -210,6 +210,14 @@ class Event {
Event_setDOM($this->_cPtr,$dom);
}
+ function getContent() {
+ return Event_getContent($this->_cPtr);
+ }
+
+ function setContent($content) {
+ Event_setContent($this->_cPtr,$content);
+ }
+
function getSendId() {
return Event_getSendId($this->_cPtr);
}
@@ -310,14 +318,6 @@ class InvokeRequest extends Event {
InvokeRequest_setSource($this->_cPtr,$src);
}
- function getContent() {
- return InvokeRequest_getContent($this->_cPtr);
- }
-
- function setContent($content) {
- InvokeRequest_setContent($this->_cPtr,$content);
- }
-
function isAutoForwarded() {
return InvokeRequest_isAutoForwarded($this->_cPtr);
}
@@ -444,14 +444,6 @@ class SendRequest extends Event {
SendRequest_setDelayMs($this->_cPtr,$delayMs);
}
- function getContent() {
- return SendRequest_getContent($this->_cPtr);
- }
-
- function setContent($content) {
- SendRequest_setContent($this->_cPtr,$content);
- }
-
function getNameList() {
$r=SendRequest_getNameList($this->_cPtr);
if (is_resource($r)) {
@@ -580,7 +572,7 @@ class InterpreterMonitor {
}
}
-abstract class Interpreter {
+class Interpreter {
public $_cPtr=null;
protected $_pData=array();
@@ -614,26 +606,42 @@ abstract class Interpreter {
static function fromDOM($node) {
$r=Interpreter_fromDOM($node);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromXML($xml) {
$r=Interpreter_fromXML($xml);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromURI($uri) {
$r=Interpreter_fromURI($uri);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromInputSource($source) {
$r=Interpreter_fromInputSource($source);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
function start() {
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 089406d..37f2b77 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -573,15 +573,8 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
// use the whole dom
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
sendReq.dom = domFactory.createDocument(contents[0].getNamespaceURI(), "", 0);
- for (int i = 0; i < contentChilds.getLength(); i++) {
- try {
- Node<std::string> newNode = sendReq.dom.importNode(contentChilds.item(i), true);
- sendReq.dom.appendChild(newNode);
- } catch (...) {
-
- }
- }
- std::cout << sendReq.dom << std::endl;
+ Node<std::string> newNode = sendReq.dom.importNode(contents[0], true);
+ sendReq.dom.appendChild(newNode);
} else {
Node<std::string> textChild = contents[0].getFirstChild();
while(textChild && textChild.getNodeType() != Node_base::TEXT_NODE) {
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 5d45e4c..7a0301c 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -107,7 +107,7 @@ public:
return _running || !_done;
}
- virtual void interpret() = 0;
+ virtual void interpret() {};
void addMonitor(InterpreterMonitor* monitor) {
_monitors.insert(monitor);
diff --git a/src/uscxml/interpreter/InterpreterDraft7.cpp b/src/uscxml/interpreter/InterpreterDraft7.cpp
index 7af2d39..5f07cfc 100644
--- a/src/uscxml/interpreter/InterpreterDraft7.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft7.cpp
@@ -253,6 +253,7 @@ function selectEventlessTransitions():
return enabledTransitions
*/
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::selectEventlessTransitions() {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -269,6 +270,7 @@ function selectTransitions(event):
return enabledTransitions
*/
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::selectTransitions(const std::string& event) {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -335,6 +337,7 @@ function computeExitSet(transitions)
*/
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::computeExitSet(const Arabica::XPath::NodeSet<std::string>& enabledTransitions,
const Arabica::XPath::NodeSet<std::string>& statesToExit) {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -351,6 +354,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft7::computeExitSet(const Ara
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::computeEntrySet(const Arabica::XPath::NodeSet<std::string>& transitions,
const Arabica::XPath::NodeSet<std::string>& statesToEnter,
const Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -375,6 +379,7 @@ function removeConflictingTransitions(enabledTransitions):
return filteredTransitions
*/
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -388,6 +393,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft7::removeConflictingTransit
return findLCCA([t.source].append(tstates))
*/
Arabica::DOM::Node<std::string> InterpreterDraft7::getTransitionDomain(const Arabica::DOM::Node<std::string>& transition) {
+ return Arabica::DOM::Node<std::string>();
}
/**
@@ -418,6 +424,7 @@ Arabica::DOM::Node<std::string> InterpreterDraft7::getTransitionDomain(const Ara
Arabica::XPath::NodeSet<std::string> InterpreterDraft7::addDescendentStatesToEnter(const Arabica::DOM::Node<std::string>& state,
const Arabica::XPath::NodeSet<std::string>& statesToEnter,
const Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ return Arabica::XPath::NodeSet<std::string>();
}
/**
@@ -433,7 +440,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft7::addAncestorsStatesToEnte
const Arabica::DOM::Node<std::string>& ancestor,
const Arabica::XPath::NodeSet<std::string>& statesToEnter,
const Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ return Arabica::XPath::NodeSet<std::string>();
}
-
} \ No newline at end of file