summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-26 21:37:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-26 21:37:03 (GMT)
commita4b506fd774ec50ad79b7531bd3698c5a6339407 (patch)
tree5e524b2c91e97f1037818e0262616f74e5e628a4 /src/bindings/swig
parentfe84b93d3e80d4b03e7a401582654c84d7fa7d9a (diff)
downloaduscxml-a4b506fd774ec50ad79b7531bd3698c5a6339407.zip
uscxml-a4b506fd774ec50ad79b7531bd3698c5a6339407.tar.gz
uscxml-a4b506fd774ec50ad79b7531bd3698c5a6339407.tar.bz2
More work on language bindings and C# examples
Diffstat (limited to 'src/bindings/swig')
-rw-r--r--src/bindings/swig/csharp/uscxml.i22
-rw-r--r--src/bindings/swig/java/uscxml.i9
-rw-r--r--src/bindings/swig/uscxml_beautify.i11
-rw-r--r--src/bindings/swig/uscxml_ignores.i140
-rw-r--r--src/bindings/swig/wrapped/WrappedDataModel.h4
-rw-r--r--src/bindings/swig/wrapped/WrappedExecutableContent.h12
-rw-r--r--src/bindings/swig/wrapped/WrappedIOProcessor.h6
-rw-r--r--src/bindings/swig/wrapped/WrappedInterpreterMonitor.cpp27
-rw-r--r--src/bindings/swig/wrapped/WrappedInterpreterMonitor.h218
9 files changed, 416 insertions, 33 deletions
diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i
index e7b7d62..6f4f214 100644
--- a/src/bindings/swig/csharp/uscxml.i
+++ b/src/bindings/swig/csharp/uscxml.i
@@ -3,9 +3,6 @@
// provide a macro for the header files
#define SWIGIMPORTED 1
-// import swig typemaps
-//%include <inttypes.i>
-
%include <stl.i>
%include <std_map.i>
%include <std_string.i>
@@ -24,6 +21,7 @@ typedef uscxml::SendRequest SendRequest;
%feature("director") uscxml::WrappedDataModel;
%feature("director") uscxml::WrappedIOProcessor;
%feature("director") uscxml::WrappedExecutableContent;
+%feature("director") uscxml::WrappedInterpreterMonitor;
// disable warning related to unknown base class
#pragma SWIG nowarn=401
@@ -32,9 +30,6 @@ typedef uscxml::SendRequest SendRequest;
%csconst(1);
-# %shared_ptr(uscxml::dom::Element);
-# %shared_ptr(uscxml::dom::Executable);
-
%rename(equals) operator==;
%rename(isValid) operator bool;
@@ -47,19 +42,14 @@ typedef uscxml::SendRequest SendRequest;
#include "../../../uscxml/Message.h"
#include "../../../uscxml/Factory.h"
-#include "../../../uscxml/concurrency/BlockingQueue.h"
#include "../../../uscxml/Interpreter.h"
-
-//#include <DOM/Document.hpp>
-//#include <DOM/Node.hpp>
-//#include <DOM/Element.hpp>
-//#include <DOM/Attr.hpp>
-//#include <DOM/Text.hpp>
+#include "../../../uscxml/concurrency/BlockingQueue.h"
#include "../wrapped/WrappedInvoker.h"
#include "../wrapped/WrappedDataModel.h"
#include "../wrapped/WrappedExecutableContent.h"
#include "../wrapped/WrappedIOProcessor.h"
+#include "../wrapped/WrappedInterpreterMonitor.h"
using namespace uscxml;
using namespace Arabica::DOM;
@@ -68,6 +58,7 @@ using namespace Arabica::DOM;
#include "../wrapped/WrappedDataModel.cpp"
#include "../wrapped/WrappedExecutableContent.cpp"
#include "../wrapped/WrappedIOProcessor.cpp"
+#include "../wrapped/WrappedInterpreterMonitor.cpp"
%}
@@ -136,10 +127,6 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
%rename Data DataNative;
-// translate param multimap to Map<String, List<Data> >
-%rename(getParamsNative) uscxml::Event::getParams();
-%csmethodmodifiers uscxml::Event::getParams() "private";
-
%include "../uscxml_beautify.i"
@@ -157,6 +144,7 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
%include "../wrapped/WrappedDataModel.h"
%include "../wrapped/WrappedExecutableContent.h"
%include "../wrapped/WrappedIOProcessor.h"
+%include "../wrapped/WrappedInterpreterMonitor.h"
%template(DataList) std::list<uscxml::Data>;
diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i
index b780f74..64dfdd5 100644
--- a/src/bindings/swig/java/uscxml.i
+++ b/src/bindings/swig/java/uscxml.i
@@ -10,7 +10,6 @@
%include "../stl_set.i"
%include "../stl_list.i"
-
%include <boost_shared_ptr.i>
typedef uscxml::Data Data;
@@ -22,6 +21,7 @@ typedef uscxml::SendRequest SendRequest;
%feature("director") uscxml::WrappedDataModel;
%feature("director") uscxml::WrappedIOProcessor;
%feature("director") uscxml::WrappedExecutableContent;
+%feature("director") uscxml::WrappedInterpreterMonitor;
// disable warning related to unknown base class
#pragma SWIG nowarn=401
@@ -49,6 +49,7 @@ typedef uscxml::SendRequest SendRequest;
#include "../wrapped/WrappedDataModel.h"
#include "../wrapped/WrappedExecutableContent.h"
#include "../wrapped/WrappedIOProcessor.h"
+#include "../wrapped/WrappedInterpreterMonitor.h"
using namespace uscxml;
using namespace Arabica::DOM;
@@ -57,6 +58,7 @@ using namespace Arabica::DOM;
#include "../wrapped/WrappedDataModel.cpp"
#include "../wrapped/WrappedExecutableContent.cpp"
#include "../wrapped/WrappedIOProcessor.cpp"
+#include "../wrapped/WrappedInterpreterMonitor.cpp"
%}
@@ -86,10 +88,6 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
%rename Data DataNative;
-// translate param multimap to Map<String, List<Data> >
-%rename(getParamsNative) uscxml::Event::getParams();
-%javamethodmodifiers uscxml::Event::getParams() "private";
-
%include "../uscxml_beautify.i"
@@ -107,6 +105,7 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
%include "../wrapped/WrappedDataModel.h"
%include "../wrapped/WrappedExecutableContent.h"
%include "../wrapped/WrappedIOProcessor.h"
+%include "../wrapped/WrappedInterpreterMonitor.h"
%template(DataList) std::list<uscxml::Data>;
diff --git a/src/bindings/swig/uscxml_beautify.i b/src/bindings/swig/uscxml_beautify.i
index 8b57e78..8a53fbb 100644
--- a/src/bindings/swig/uscxml_beautify.i
+++ b/src/bindings/swig/uscxml_beautify.i
@@ -1,3 +1,14 @@
+%rename(NativeDataModel) DataModel;
+%rename(DataModel) WrappedDataModel;
+%rename(NativeExecutableContent) ExecutableContent;
+%rename(ExecutableContent) WrappedExecutableContent;
+%rename(NativeInvoker) Invoker;
+%rename(Invoker) WrappedInvoker;
+%rename(NativeIOProcessor) IOProcessor;
+%rename(IOProcessor) WrappedIOProcessor;
+%rename(NativeInterpreterMonitor) InterpreterMonitor;
+%rename(InterpreterMonitor) WrappedInterpreterMonitor;
+
%extend uscxml::Event {
std::vector<std::pair<std::string, Data> > getParamPairs() {
std::vector<std::pair<std::string, Data> > pairs;
diff --git a/src/bindings/swig/uscxml_ignores.i b/src/bindings/swig/uscxml_ignores.i
index 4f8b2a3..38b3e9e 100644
--- a/src/bindings/swig/uscxml_ignores.i
+++ b/src/bindings/swig/uscxml_ignores.i
@@ -1,14 +1,48 @@
%ignore uscxml::NumAttr;
%ignore uscxml::SCXMLParser;
%ignore uscxml::InterpreterImpl;
+#if 0
+%ignore uscxml::EventHandlerImpl;
+#endif
%ignore create();
+%ignore uscxml::EventHandlerImpl::setInterpreter(InterpreterImpl*);
+%ignore uscxml::EventHandlerImpl::getInterpreter;
+%ignore uscxml::EventHandlerImpl::setElement(const Arabica::DOM::Element<std::string>&);
+%ignore uscxml::EventHandlerImpl::getElement;
+%ignore uscxml::EventHandlerImpl::runOnMainThread;
+
+%ignore uscxml::EventHandler::EventHandler(const boost::shared_ptr<EventHandlerImpl>);
+%ignore uscxml::EventHandler::EventHandler(EventHandler&);
+%ignore uscxml::EventHandler::setInterpreter(InterpreterImpl*);
+%ignore uscxml::EventHandler::getInterpreter;
+%ignore uscxml::EventHandler::setElement(const Arabica::DOM::Element<std::string>&);
+%ignore uscxml::EventHandler::getElement;
+%ignore uscxml::EventHandler::runOnMainThread;
+
+
+%ignore uscxml::NameSpaceInfo::NameSpaceInfo(const std::map<std::string, std::string>&);
+%ignore uscxml::NameSpaceInfo::NameSpaceInfo(const NameSpaceInfo&);
+%ignore uscxml::NameSpaceInfo::setPrefix(Arabica::DOM::Element<std::string>);
+%ignore uscxml::NameSpaceInfo::setPrefix(Arabica::DOM::Attr<std::string>);
+%ignore uscxml::NameSpaceInfo::getNSContext;
+%ignore uscxml::NameSpaceInfo::nsURL;
+%ignore uscxml::NameSpaceInfo::xpathPrefix;
+%ignore uscxml::NameSpaceInfo::xmlNSPrefix;
+%ignore uscxml::NameSpaceInfo::nsToPrefix;
+%ignore uscxml::NameSpaceInfo::nsInfo;
+
+// interpreter
+
+%ignore uscxml::Interpreter::Interpreter(const boost::shared_ptr<InterpreterImpl>);
+%ignore uscxml::Interpreter::Interpreter(const Interpreter&);
%ignore uscxml::Interpreter::getDelayQueue();
%ignore uscxml::Interpreter::fromDOM;
%ignore uscxml::Interpreter::fromClone;
%ignore uscxml::Interpreter::start();
%ignore uscxml::Interpreter::stop();
+%ignore uscxml::Interpreter::isRunning();
%ignore uscxml::Interpreter::setCmdLineOptions(std::map<std::string, std::string>);
%ignore uscxml::Interpreter::getDocument;
%ignore uscxml::Interpreter::getImpl;
@@ -18,7 +52,71 @@
%ignore uscxml::Interpreter::isLegalConfiguration(const Arabica::XPath::NodeSet<std::string>&);
%ignore uscxml::Interpreter::getInstances();
+// InterpreterMonitor
+
+%ignore uscxml::InterpreterMonitor::beforeExitingState(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+%ignore uscxml::InterpreterMonitor::afterExitingState(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+%ignore uscxml::InterpreterMonitor::beforeEnteringState(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+%ignore uscxml::InterpreterMonitor::afterEnteringState(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+
+%ignore uscxml::InterpreterMonitor::beforeUninvoking(Interpreter, const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::InterpreterMonitor::afterUninvoking(Interpreter, const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::InterpreterMonitor::beforeInvoking(Interpreter, const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::InterpreterMonitor::afterInvoking(Interpreter, const Arabica::DOM::Element<std::string>&, const std::string&);
+
+%ignore uscxml::InterpreterMonitor::beforeTakingTransition(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+%ignore uscxml::InterpreterMonitor::afterTakingTransition(Interpreter, const Arabica::DOM::Element<std::string>&, bool);
+
+%ignore uscxml::InterpreterMonitor::beforeExecutingContent(Interpreter, const Arabica::DOM::Element<std::string>&);
+%ignore uscxml::InterpreterMonitor::afterExecutingContent(Interpreter, const Arabica::DOM::Element<std::string>&);
+
+
+%ignore uscxml::InterpreterOptions::fromCmdLine(int, char**);
+%ignore uscxml::InterpreterOptions::additionalParameters;
+%ignore uscxml::InterpreterOptions::interpreters;
+
+// Invoker
+
+%ignore uscxml::Invoker::Invoker(const boost::shared_ptr<InvokerImpl>);
+%ignore uscxml::Invoker::setInterpreter(InterpreterImpl*);
+%ignore uscxml::Invoker::getInterpreter;
+
+%ignore uscxml::InvokerImpl::create(InterpreterImpl*);
%ignore uscxml::WrappedInvoker::create(InterpreterImpl*);
+%ignore uscxml::InvokerImpl::setInterpreter(InterpreterImpl*);
+%ignore uscxml::InvokerImpl::getInterpreter;
+
+
+// DataModel
+
+%ignore uscxml::DataModel::DataModel(const boost::shared_ptr<DataModelImpl>);
+%ignore uscxml::DataModel::DataModel(const DataModel&);
+%ignore uscxml::DataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::DataModel::evalAsBool(const Arabica::DOM::Node<std::string>&, const std::string&);
+%ignore uscxml::DataModel::throwErrorExecution(const std::string&);
+%ignore uscxml::DataModel::throwErrorPlatform(const std::string&);
+%ignore uscxml::DataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::DataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Node<std::string>&, const std::string&);
+%ignore uscxml::DataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::DataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Node<std::string>&, const std::string&);
+%ignore uscxml::DataModel::replaceExpressions(std::string&);
+%ignore uscxml::DataModel::setInterpreter(InterpreterImpl*);
+%ignore uscxml::DataModel::getInterpreter;
+
+%ignore uscxml::DataModelImpl::create(InterpreterImpl*);
+%ignore uscxml::DataModelImpl::throwErrorExecution(const std::string&);
+%ignore uscxml::DataModelImpl::throwErrorPlatform(const std::string&);
+%ignore uscxml::DataModelImpl::setInterpreter(InterpreterImpl*);
+%ignore uscxml::DataModelImpl::getInterpreter;
+%ignore uscxml::DataModelImpl::replaceExpressions(std::string&);
+%ignore uscxml::DataModelImpl::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::DataModelImpl::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Node<std::string>&, const std::string&);
+%ignore uscxml::DataModelImpl::init(const std::string&, const Data&);
+%ignore uscxml::DataModelImpl::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::DataModelImpl::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Node<std::string>&, const std::string&);
+%ignore uscxml::DataModelImpl::assign(const std::string&, const Data&);
+%ignore uscxml::DataModelImpl::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::DataModelImpl::evalAsBool(const Arabica::DOM::Node<std::string>&, const std::string&);
%ignore uscxml::WrappedDataModel::create(InterpreterImpl*);
%ignore uscxml::WrappedDataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
@@ -30,18 +128,60 @@
%ignore uscxml::WrappedDataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
%ignore uscxml::WrappedDataModel::evalAsBool(const Arabica::DOM::Node<std::string>&, const std::string&);
+
+// Executable Content
+
+%ignore uscxml::ExecutableContent::ExecutableContent(const boost::shared_ptr<ExecutableContentImpl>);
+%ignore uscxml::ExecutableContent::ExecutableContent(const ExecutableContent&);
+%ignore uscxml::ExecutableContent::setInterpreter(InterpreterImpl*);
+%ignore uscxml::ExecutableContent::getInterpreter;
+%ignore uscxml::ExecutableContent::enterElement(const Arabica::DOM::Node<std::string>&);
+%ignore uscxml::ExecutableContent::exitElement(const Arabica::DOM::Node<std::string>&);
+
+%ignore uscxml::ExecutableContentImpl::create(InterpreterImpl*);
+%ignore uscxml::ExecutableContentImpl::enterElement(const Arabica::DOM::Node<std::string>&);
+%ignore uscxml::ExecutableContentImpl::exitElement(const Arabica::DOM::Node<std::string>&);
+%ignore uscxml::ExecutableContentImpl::setInterpreter(InterpreterImpl*);
+%ignore uscxml::ExecutableContentImpl::getInterpreter;
+
%ignore uscxml::WrappedExecutableContent::create(InterpreterImpl*);
%ignore uscxml::WrappedExecutableContent::enterElement(const Arabica::DOM::Node<std::string>&);
%ignore uscxml::WrappedExecutableContent::exitElement(const Arabica::DOM::Node<std::string>&);
+
+// IOProcessor
+
+%ignore uscxml::IOProcessorImpl::create(InterpreterImpl*);
+
+%ignore uscxml::IOProcessor::IOProcessor(const boost::shared_ptr<IOProcessorImpl>);
+%ignore uscxml::IOProcessor::IOProcessor(const IOProcessor&);
+
%ignore uscxml::WrappedIOProcessor::create(InterpreterImpl*);
+
+// Factory
+
+%ignore uscxml::Factory::createDataModel;
+%ignore uscxml::Factory::createIOProcessor;
+%ignore uscxml::Factory::createInvoker;
+%ignore uscxml::Factory::createExecutableContent;
+%ignore uscxml::Factory::getIOProcessors;
+
+// Event
+
%ignore uscxml::Event::Event(const Arabica::DOM::Node<std::string>&);
%ignore uscxml::Event::getStrippedDOM;
%ignore uscxml::Event::getFirstDOMElement;
+%ignore uscxml::Event::dom;
%ignore uscxml::Event::getDOM();
%ignore uscxml::Event::setDOM(const Arabica::DOM::Document<std::string>&);
%ignore uscxml::Event::toDocument();
+%ignore uscxml::Event::getParams();
+
+// Data
+
+%ignore uscxml::Data::toDocument;
+%ignore uscxml::Data::Data(const Arabica::DOM::Node<std::string>&);
%ignore operator!=;
%ignore operator<;
diff --git a/src/bindings/swig/wrapped/WrappedDataModel.h b/src/bindings/swig/wrapped/WrappedDataModel.h
index 026bed2..0d0630c 100644
--- a/src/bindings/swig/wrapped/WrappedDataModel.h
+++ b/src/bindings/swig/wrapped/WrappedDataModel.h
@@ -43,6 +43,10 @@ public:
return std::list<std::string>();
};
+ virtual std::string andExpressions(std::list<std::string>) {
+ return "";
+ }
+
virtual bool validate(const std::string& location, const std::string& schema) {
return true;
}
diff --git a/src/bindings/swig/wrapped/WrappedExecutableContent.h b/src/bindings/swig/wrapped/WrappedExecutableContent.h
index 24c6978..fb09e54 100644
--- a/src/bindings/swig/wrapped/WrappedExecutableContent.h
+++ b/src/bindings/swig/wrapped/WrappedExecutableContent.h
@@ -39,11 +39,11 @@ public:
_interpreter = interpreter->shared_from_this();
return boost::shared_ptr<ExecutableContentImpl>(create(_interpreter));
}
-
+
virtual std::string getLocalName() {
return "";
}
-
+
virtual std::string getNamespace() {
return "http://www.w3.org/2005/07/scxml";
}
@@ -57,7 +57,7 @@ public:
virtual void exitElement(const Arabica::DOM::Node<std::string>& node) {
std::ostringstream ssElement;
ssElement << node;
- exitElement(ssElement.str());
+ exitElement(ssElement.str());
}
virtual bool processChildren() {
@@ -65,15 +65,11 @@ public:
}
virtual void enterElement(const std::string& node) {
-
+
}
virtual void exitElement(const std::string& node) {
-
- }
- void croak() throw(Event) {
-
}
private:
diff --git a/src/bindings/swig/wrapped/WrappedIOProcessor.h b/src/bindings/swig/wrapped/WrappedIOProcessor.h
index 70c400e..716d9f4 100644
--- a/src/bindings/swig/wrapped/WrappedIOProcessor.h
+++ b/src/bindings/swig/wrapped/WrappedIOProcessor.h
@@ -47,11 +47,11 @@ public:
Data data;
return data;
}
-
+
virtual void send(const SendRequest& req) {
-
+
}
-
+
private:
Interpreter _interpreter;
};
diff --git a/src/bindings/swig/wrapped/WrappedInterpreterMonitor.cpp b/src/bindings/swig/wrapped/WrappedInterpreterMonitor.cpp
new file mode 100644
index 0000000..1c99101
--- /dev/null
+++ b/src/bindings/swig/wrapped/WrappedInterpreterMonitor.cpp
@@ -0,0 +1,27 @@
+/**
+ * @file
+ * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "WrappedInterpreterMonitor.h"
+
+namespace uscxml {
+
+WrappedInterpreterMonitor::WrappedInterpreterMonitor() {}
+WrappedInterpreterMonitor::~WrappedInterpreterMonitor() {}
+
+} \ No newline at end of file
diff --git a/src/bindings/swig/wrapped/WrappedInterpreterMonitor.h b/src/bindings/swig/wrapped/WrappedInterpreterMonitor.h
new file mode 100644
index 0000000..57372ea
--- /dev/null
+++ b/src/bindings/swig/wrapped/WrappedInterpreterMonitor.h
@@ -0,0 +1,218 @@
+/**
+ * @file
+ * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef WRAPPEDINTERPRETERMONITOR_H_F5C83A0D
+#define WRAPPEDINTERPRETERMONITOR_H_F5C83A0D
+
+
+#include "../../../uscxml/Message.h"
+#include "../../../uscxml/Factory.h"
+#include "../../../uscxml/Interpreter.h"
+#include "../../../uscxml/DOMUtils.h"
+
+namespace uscxml {
+
+class WrappedInterpreterMonitor : public InterpreterMonitor {
+public:
+ WrappedInterpreterMonitor();
+ virtual ~WrappedInterpreterMonitor();
+
+ virtual void beforeExitingState(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& state,
+ bool moreComing) {
+ std::stringstream ss;
+ ss << state;
+ beforeExitingState(interpreter, state.getAttribute("id"), DOMUtils::xPathForNode(state), ss.str(), moreComing);
+ }
+ virtual void beforeExitingState(Interpreter interpreter,
+ const std::string& stateId,
+ const std::string& xpath,
+ const std::string& state,
+ bool moreComing) {}
+
+
+ virtual void afterExitingState(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& state,
+ bool moreComing) {
+ std::stringstream ss;
+ ss << state;
+ afterExitingState(interpreter, state.getAttribute("id"), DOMUtils::xPathForNode(state), ss.str(), moreComing);
+ }
+ virtual void afterExitingState(Interpreter interpreter,
+ const std::string& stateId,
+ const std::string& xpath,
+ const std::string& state,
+ bool moreComing) { }
+
+
+ virtual void beforeExecutingContent(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& element) {
+ std::stringstream ss;
+ ss << element;
+ beforeExecutingContent(interpreter, element.getTagName(), DOMUtils::xPathForNode(element), ss.str());
+ }
+ virtual void beforeExecutingContent(Interpreter interpreter,
+ const std::string& tagName,
+ const std::string& xpath,
+ const std::string& element) {}
+
+
+ virtual void afterExecutingContent(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& element) {
+ std::stringstream ss;
+ ss << element;
+ afterExecutingContent(interpreter, element.getTagName(), DOMUtils::xPathForNode(element), ss.str());
+ }
+ virtual void afterExecutingContent(Interpreter interpreter,
+ const std::string& tagName,
+ const std::string& xpath,
+ const std::string& element) {}
+
+
+ virtual void beforeUninvoking(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& invokeElem,
+ const std::string& invokeid) {
+ std::stringstream ss;
+ ss << invokeElem;
+ beforeUninvoking(interpreter, DOMUtils::xPathForNode(invokeElem), invokeid, ss.str());
+ }
+ virtual void beforeUninvoking(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& invokeid,
+ const std::string& element) {}
+
+
+ virtual void afterUninvoking(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& invokeElem,
+ const std::string& invokeid) {
+ std::stringstream ss;
+ ss << invokeElem;
+ afterUninvoking(interpreter, DOMUtils::xPathForNode(invokeElem), invokeid, ss.str());
+ }
+ virtual void afterUninvoking(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& invokeid,
+ const std::string& element) {}
+
+
+ virtual void beforeTakingTransition(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& transition,
+ bool moreComing) {
+ Arabica::DOM::Node<std::string> sourceState = interpreter.getImpl()->getSourceState(transition);
+ Arabica::XPath::NodeSet<std::string> targetStates = interpreter.getImpl()->getTargetStates(transition);
+
+ std::stringstream ss;
+ ss << transition;
+
+ std::list<std::string> targets;
+ for (int i = 0; i < targetStates.size(); i++) {
+ targets.push_back(ATTR(targetStates[i], "id"));
+ }
+
+ beforeTakingTransition(interpreter, DOMUtils::xPathForNode(transition), ATTR(sourceState, "id"), targets, ss.str(), moreComing);
+ }
+ virtual void beforeTakingTransition(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& source,
+ const std::list<std::string>& targets,
+ const std::string& element,
+ bool moreComing) {}
+
+ virtual void afterTakingTransition(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& transition,
+ bool moreComing) {
+ Arabica::DOM::Node<std::string> sourceState = interpreter.getImpl()->getSourceState(transition);
+ Arabica::XPath::NodeSet<std::string> targetStates = interpreter.getImpl()->getTargetStates(transition);
+
+ std::stringstream ss;
+ ss << transition;
+
+ std::list<std::string> targets;
+ for (int i = 0; i < targetStates.size(); i++) {
+ targets.push_back(ATTR(targetStates[i], "id"));
+ }
+
+ afterTakingTransition(interpreter, DOMUtils::xPathForNode(transition), ATTR(sourceState, "id"), targets, ss.str(), moreComing);
+ }
+ virtual void afterTakingTransition(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& source,
+ const std::list<std::string>& targets,
+ const std::string& element,
+ bool moreComing) {}
+
+
+ virtual void beforeEnteringState(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& state,
+ bool moreComing) {
+ std::stringstream ss;
+ ss << state;
+ beforeEnteringState(interpreter, state.getAttribute("id"), DOMUtils::xPathForNode(state), ss.str(), moreComing);
+ }
+ virtual void beforeEnteringState(Interpreter interpreter,
+ const std::string& stateId,
+ const std::string& xpath,
+ const std::string& state,
+ bool moreComing) {}
+
+
+ virtual void afterEnteringState(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& state,
+ bool moreComing) {
+ std::stringstream ss;
+ ss << state;
+ afterEnteringState(interpreter, state.getAttribute("id"), DOMUtils::xPathForNode(state), ss.str(), moreComing);
+ }
+ virtual void afterEnteringState(Interpreter interpreter,
+ const std::string& stateId,
+ const std::string& xpath,
+ const std::string& state,
+ bool moreComing) {}
+
+
+ virtual void beforeInvoking(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& invokeElem,
+ const std::string& invokeid) {
+ std::stringstream ss;
+ ss << invokeElem;
+ beforeInvoking(interpreter, DOMUtils::xPathForNode(invokeElem), invokeid, ss.str());
+ }
+ virtual void beforeInvoking(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& invokeid,
+ const std::string& element) {}
+
+ virtual void afterInvoking(Interpreter interpreter,
+ const Arabica::DOM::Element<std::string>& invokeElem,
+ const std::string& invokeid) {
+ std::stringstream ss;
+ ss << invokeElem;
+ afterInvoking(interpreter, DOMUtils::xPathForNode(invokeElem), invokeid, ss.str());
+ }
+ virtual void afterInvoking(Interpreter interpreter,
+ const std::string& xpath,
+ const std::string& invokeid,
+ const std::string& element) {}
+
+};
+
+}
+
+
+#endif /* end of include guard: WRAPPEDINTERPRETERMONITOR_H_F5C83A0D */