summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig/csharp
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/csharp
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/csharp')
-rw-r--r--src/bindings/swig/csharp/CMakeLists.txt3
-rw-r--r--src/bindings/swig/csharp/uscxml.i57
2 files changed, 58 insertions, 2 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();