summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
commitb542369263782dc8b85893e218119ed070efa7b3 (patch)
tree0a18012a0af991755ceab98a457b46b79c14129f /src/bindings/swig
parent193a01614dc3290eec51745a91be65c166c3763b (diff)
downloaduscxml-b542369263782dc8b85893e218119ed070efa7b3.zip
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.gz
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.bz2
Got ready for cmake3 and some minor fixes
Diffstat (limited to 'src/bindings/swig')
-rw-r--r--src/bindings/swig/csharp/CMakeLists.txt3
-rw-r--r--src/bindings/swig/csharp/uscxml.i57
-rw-r--r--src/bindings/swig/java/uscxml.i57
-rw-r--r--src/bindings/swig/uscxml_beautify.i52
-rw-r--r--src/bindings/swig/wrapped/WrappedIOProcessor.h2
5 files changed, 119 insertions, 52 deletions
diff --git a/src/bindings/swig/csharp/CMakeLists.txt b/src/bindings/swig/csharp/CMakeLists.txt
index 80d093e..ee37bf7 100644
--- a/src/bindings/swig/csharp/CMakeLists.txt
+++ b/src/bindings/swig/csharp/CMakeLists.txt
@@ -2,9 +2,8 @@
# Make from within Eclipse fails miserably with the whole thing
if (WIN32)
- LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files (x86)/swig") # swig.exe
- #LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v4.0.30319") # CSharp compiler
LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v3.5") # CSharp compiler
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v4.0.30319") # CSharp compiler
endif()
FIND_PROGRAM(DMCS_EXECUTABLE dmcs PATHS $ENV{DMCS_HOME} ENV PATH ) # Mono compiler
diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i
index 8e9a297..2a1ac07 100644
--- a/src/bindings/swig/csharp/uscxml.i
+++ b/src/bindings/swig/csharp/uscxml.i
@@ -36,6 +36,8 @@ typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
#pragma SWIG nowarn=401
// do not warn when we override symbols via extend
#pragma SWIG nowarn=302
+// do not warn when ignoring overrided method
+#pragma SWIG nowarn=516
%csconst(1);
@@ -133,14 +135,69 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::step);
WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
+%define WRAP_TO_STRING( CLASSNAME )
+%csmethodmodifiers CLASSNAME::ToString() "public override";
+%extend CLASSNAME {
+ virtual std::string ToString() {
+ std::stringstream ss;
+ ss << *self;
+ return ss.str();
+ }
+};
+%enddef
+
+WRAP_TO_STRING(uscxml::Event);
+WRAP_TO_STRING(uscxml::Data);
+WRAP_TO_STRING(uscxml::SendRequest);
+WRAP_TO_STRING(uscxml::InvokeRequest);
+
%include "../uscxml_ignores.i"
//***********************************************
// Beautify important classes
//***********************************************
+%csmethodmodifiers uscxml::Event::getParamMap() "private";
+%csmethodmodifiers uscxml::Event::getParamMapKeys() "private";
+%csmethodmodifiers uscxml::Event::setParamMap(const std::map<std::string, std::list<uscxml::Data> >&) "private";
+%csmethodmodifiers uscxml::Event::getNameListKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getIOProcessorKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getInvokerKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getInvokers() "private";
+%csmethodmodifiers uscxml::Interpreter::getIOProcessors() "private";
+%csmethodmodifiers uscxml::Data::getCompoundKeys() "private";
+
%include "../uscxml_beautify.i"
+%typemap(csimports) uscxml::Interpreter %{
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+%}
+
+%typemap(cscode) uscxml::Interpreter %{
+ public Dictionary<string, NativeIOProcessor> getIOProcessors() {
+ Dictionary<string, NativeIOProcessor> ioProcs = new Dictionary<string, NativeIOProcessor>();
+ StringVector keys = getIOProcessorKeys();
+ IOProcMap ioProcMap = getIOProcessorsNative();
+ for (int i = 0; i < keys.Count; i++) {
+ ioProcs[keys[i]] = ioProcMap[keys[i]];
+ }
+ return ioProcs;
+ }
+
+ public Dictionary<string, NativeInvoker> getInvokers() {
+ Dictionary<string, NativeInvoker> invokers = new Dictionary<string, NativeInvoker>();
+ StringVector keys = getInvokerKeys();
+ InvokerMap invokerMap = getInvokersNative();
+ for (int i = 0; i < keys.Count; i++) {
+ invokers[keys[i]] = invokerMap[keys[i]];
+ }
+ return invokers;
+ }
+
+%}
+
%rename(getCompoundNative) uscxml::Data::getCompound();
%rename(getArrayNative) uscxml::Data::getArray();
diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i
index cb760e4..ee95eb0 100644
--- a/src/bindings/swig/java/uscxml.i
+++ b/src/bindings/swig/java/uscxml.i
@@ -36,6 +36,8 @@ typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
#pragma SWIG nowarn=401
// do not warn when we override symbols via extend
#pragma SWIG nowarn=302
+// do not warn when ignoring overrided method
+#pragma SWIG nowarn=516
%javaconst(1);
@@ -93,6 +95,21 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::step);
WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
+%define WRAP_TO_STRING( CLASSNAME )
+%extend CLASSNAME {
+ virtual std::string toString() {
+ std::stringstream ss;
+ ss << *self;
+ return ss.str();
+ }
+};
+%enddef
+
+WRAP_TO_STRING(uscxml::Event);
+WRAP_TO_STRING(uscxml::Data);
+WRAP_TO_STRING(uscxml::SendRequest);
+WRAP_TO_STRING(uscxml::InvokeRequest);
+
%include "../uscxml_ignores.i"
// see http://swig.org/Doc2.0/Java.html#Java_date_marshalling
@@ -153,9 +170,49 @@ BEAUTIFY_NATIVE(uscxml::InvokeRequest, InvokeRequest, InvokeRequestNative);
// Beautify important classes
//***********************************************
+%javamethodmodifiers uscxml::Event::getParamMap() "private";
+%javamethodmodifiers uscxml::Event::getParamMapKeys() "private";
+%javamethodmodifiers uscxml::Event::setParamMap(const std::map<std::string, std::list<uscxml::Data> >&) "private";
+%javamethodmodifiers uscxml::Event::getNameListKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getIOProcessorKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getInvokerKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getInvokers() "private";
+%javamethodmodifiers uscxml::Interpreter::getIOProcessors() "private";
+%javamethodmodifiers uscxml::Data::getCompoundKeys() "private";
+
%include "../uscxml_beautify.i"
+%typemap(javaimports) uscxml::Interpreter %{
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+%}
+
+%typemap(javacode) uscxml::Interpreter %{
+ public Map<String, NativeIOProcessor> getIOProcessors() {
+ Map<String, NativeIOProcessor> ioProcs = new HashMap<String, NativeIOProcessor>();
+ StringVector keys = getIOProcessorKeys();
+ IOProcMap ioProcMap = getIOProcessorsNative();
+ for (int i = 0; i < keys.size(); i++) {
+ ioProcs.put(keys.get(i), ioProcMap.get(keys.get(i)));
+ }
+ return ioProcs;
+ }
+
+ public Map<String, NativeInvoker> getInvokers() {
+ Map<String, NativeInvoker> invokers = new HashMap<String, NativeInvoker>();
+ StringVector keys = getInvokerKeys();
+ InvokerMap invokerMap = getInvokersNative();
+ for (int i = 0; i < keys.size(); i++) {
+ invokers.put(keys.get(i), invokerMap.get(keys.get(i)));
+ }
+ return invokers;
+ }
+
+%}
+
%rename(getCompoundNative) uscxml::Data::getCompound();
%rename(getArrayNative) uscxml::Data::getArray();
%rename(setCompoundNative) uscxml::Data::setCompound(const std::map<std::string, Data>&);
diff --git a/src/bindings/swig/uscxml_beautify.i b/src/bindings/swig/uscxml_beautify.i
index ac3ed44..6daba77 100644
--- a/src/bindings/swig/uscxml_beautify.i
+++ b/src/bindings/swig/uscxml_beautify.i
@@ -9,34 +9,10 @@
%rename(NativeInterpreterMonitor) InterpreterMonitor;
%rename(InterpreterMonitor) WrappedInterpreterMonitor;
-%extend uscxml::Event {
-/* std::vector<std::pair<std::string, uscxml::Data> > getParamPairs() {
- std::vector<std::pair<std::string, Data> > pairs;
- std::multimap<std::string, Data>::iterator paramPairIter = self->getParams().begin();
- while(paramPairIter != self->getParams().end()) {
- pairs.push_back(*paramPairIter);
- paramPairIter++;
- }
- return pairs;
- }
+%rename(getInvokersNative) uscxml::Interpreter::getInvokers();
+%rename(getIOProcessorsNative) uscxml::Interpreter::getIOProcessors();
- void setParamPairs(const std::vector<std::pair<std::string, uscxml::Data> >& pairs) {
- std::multimap<std::string, Data> params;
- std::vector<std::pair<std::string, Data> >::const_iterator pairIter = pairs.begin();
- while(pairIter != pairs.end()) {
- params.insert(std::make_pair(pairIter->first, pairIter->second));
- pairIter++;
- }
- self->setParams(params);
- }
-*/
-
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-
+%extend uscxml::Event {
std::map<std::string, std::list<uscxml::Data> > getParamMap() {
std::map<std::string, std::list<uscxml::Data> > paramMap;
std::multimap<std::string, Data>::const_iterator paramPairIter = self->getParams().begin();
@@ -127,12 +103,6 @@
};
%extend uscxml::Data {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-
std::vector<std::string> getCompoundKeys() {
std::vector<std::string> keys;
std::map<std::string, Data>::const_iterator iter = self->compound.begin();
@@ -143,19 +113,3 @@
return keys;
}
};
-
-%extend uscxml::SendRequest {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-};
-
-%extend uscxml::InvokeRequest {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-}; \ No newline at end of file
diff --git a/src/bindings/swig/wrapped/WrappedIOProcessor.h b/src/bindings/swig/wrapped/WrappedIOProcessor.h
index b4e4938..0b5cfe8 100644
--- a/src/bindings/swig/wrapped/WrappedIOProcessor.h
+++ b/src/bindings/swig/wrapped/WrappedIOProcessor.h
@@ -47,7 +47,7 @@ public:
_interpreter = interpreter->shared_from_this();
return boost::shared_ptr<IOProcessorImpl>(create(_interpreter));
}
-
+
virtual std::list<std::string> getNames() {
return std::list<std::string>();
};