diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-01 22:51:30 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-01 22:51:30 (GMT) |
commit | 945160d0539ad119ffc986fac712db76c7203e84 (patch) | |
tree | c43e4a7db898026bc62cc20af5061d07736f847e /src/bindings/swig | |
parent | c70d02010ea99e6c8e35da3b767f41f1ee5dce56 (diff) | |
download | uscxml-945160d0539ad119ffc986fac712db76c7203e84.zip uscxml-945160d0539ad119ffc986fac712db76c7203e84.tar.gz uscxml-945160d0539ad119ffc986fac712db76c7203e84.tar.bz2 |
More polishing for bindings C# and Java
Diffstat (limited to 'src/bindings/swig')
-rw-r--r-- | src/bindings/swig/csharp/org/uscxml/InterpreterException.cs | 2 | ||||
-rw-r--r-- | src/bindings/swig/csharp/uscxml.i | 147 | ||||
-rw-r--r-- | src/bindings/swig/java/org/uscxml/Data.java | 89 | ||||
-rw-r--r-- | src/bindings/swig/java/uscxml.i | 211 | ||||
-rw-r--r-- | src/bindings/swig/uscxml_beautify.i | 97 | ||||
-rw-r--r-- | src/bindings/swig/uscxml_ignores.i | 6 | ||||
-rw-r--r-- | src/bindings/swig/wrapped/WrappedDataModel.h | 1 | ||||
-rw-r--r-- | src/bindings/swig/wrapped/WrappedExecutableContent.h | 2 | ||||
-rw-r--r-- | src/bindings/swig/wrapped/WrappedIOProcessor.h | 1 | ||||
-rw-r--r-- | src/bindings/swig/wrapped/WrappedInvoker.h | 1 |
10 files changed, 446 insertions, 111 deletions
diff --git a/src/bindings/swig/csharp/org/uscxml/InterpreterException.cs b/src/bindings/swig/csharp/org/uscxml/InterpreterException.cs index f86dc0e..38430d8 100644 --- a/src/bindings/swig/csharp/org/uscxml/InterpreterException.cs +++ b/src/bindings/swig/csharp/org/uscxml/InterpreterException.cs @@ -1,5 +1,5 @@ namespace org.uscxml { - class InterpreterException : System.ApplicationException { + public class InterpreterException : System.ApplicationException { public InterpreterException(string message) : base(message) { } diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i index 988c541..8e9a297 100644 --- a/src/bindings/swig/csharp/uscxml.i +++ b/src/bindings/swig/csharp/uscxml.i @@ -12,10 +12,19 @@ %include <boost_shared_ptr.i> +// these are needed at least for the templates to work typedef uscxml::Data Data; typedef uscxml::Event Event; typedef uscxml::InvokeRequest InvokeRequest; typedef uscxml::SendRequest SendRequest; +typedef uscxml::Invoker Invoker; +typedef uscxml::IOProcessor IOProcessor; +typedef uscxml::DataModel DataModel; +typedef uscxml::ExecutableContent ExecutableContent; +typedef uscxml::InvokerImpl InvokerImpl; +typedef uscxml::IOProcessorImpl IOProcessorImpl; +typedef uscxml::DataModelImpl DataModelImpl; +typedef uscxml::ExecutableContentImpl ExecutableContentImpl; %feature("director") uscxml::WrappedInvoker; %feature("director") uscxml::WrappedDataModel; @@ -54,6 +63,7 @@ typedef uscxml::SendRequest SendRequest; using namespace uscxml; using namespace Arabica::DOM; +// the wrapped* C++ classes get rid of DOM nodes and provide more easily wrapped base classes #include "../wrapped/WrappedInvoker.cpp" #include "../wrapped/WrappedDataModel.cpp" #include "../wrapped/WrappedExecutableContent.cpp" @@ -125,11 +135,139 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret); %include "../uscxml_ignores.i" -%rename Data DataNative; +//*********************************************** +// Beautify important classes +//*********************************************** %include "../uscxml_beautify.i" +%rename(getCompoundNative) uscxml::Data::getCompound(); +%rename(getArrayNative) uscxml::Data::getArray(); +%rename(setCompoundNative) uscxml::Data::setCompound(const std::map<std::string, Data>&); +%rename(setArrayNative) uscxml::Data::setArray(const std::list<Data>&); +%csmethodmodifiers uscxml::Data::getCompound() "private"; +%csmethodmodifiers uscxml::Data::getArray() "private"; +%csmethodmodifiers uscxml::Data::setCompound(const std::map<std::string, Data>&) "private"; +%csmethodmodifiers uscxml::Data::setArray(const std::list<Data>&) "private"; +%csmethodmodifiers uscxml::Data::getCompoundKeys() "private"; + +%typemap(csimports) uscxml::Data %{ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +%} + +%typemap(cscode) uscxml::Data %{ + public Data(List<Data> arr) : this() { + setArray(arr); + } + + public Data(Dictionary<string, Data> compound) : this() { + setCompound(compound); + } + + public Dictionary<string, Data> getCompound() { + Dictionary<string, Data> compound = new Dictionary<string, Data>(); + DataMap dataMap = getCompoundNative(); + StringVector dataMapKeys = getCompoundKeys(); + for (int i = 0; i < dataMapKeys.Count; i++) { + compound[dataMapKeys[i]] = dataMap[dataMapKeys[i]]; + } + return compound; + } + + public void setCompound(Dictionary<string, Data> compound) { + DataMap dataMap = new DataMap(); + foreach(KeyValuePair<string, Data> entry in compound) { + dataMap.Add(entry); + } + setCompoundNative(dataMap); + } + + public List<Data> getArray() { + List<Data> arr = new List<Data>(); + DataList dataList = getArrayNative(); + for (int i = 0; i < dataList.size(); i++) { + arr.Add(dataList.get(i)); + } + return arr; + } + + public void setArray(List<Data> arr) { + DataList dataList = new DataList(); + foreach (Data data in arr) { + dataList.add(data); + } + setArrayNative(dataList); + } + +%} + +%rename(getNameListNative) uscxml::Event::getNameList(); +%rename(getParamsNative) uscxml::Event::getParams(); +%rename(setNameListNative) uscxml::Event::setNameList(const std::map<std::string, Data>&); +%rename(setParamsNative) uscxml::Event::setParams(const std::multimap<std::string, Data>&); +%csmethodmodifiers uscxml::Event::getNameList() "private"; +%csmethodmodifiers uscxml::Event::getNameListKeys() "private"; +%csmethodmodifiers uscxml::Event::getParams() "private"; +%csmethodmodifiers uscxml::Event::setNameList(const std::map<std::string, Data>&) "private"; +%csmethodmodifiers uscxml::Event::setParams(const std::multimap<std::string, Data>&) "private"; + +%typemap(csimports) uscxml::Event %{ + using System; + using System.Collections.Generic; + using System.Runtime.InteropServices; +%} + +%typemap(cscode) uscxml::Event %{ + public Dictionary<string, List<Data> > getParams() { + Dictionary<string, List<Data>> parameters = new Dictionary<string, List<Data>>(); + ParamMap paramMap = getParamMap(); + + foreach (KeyValuePair<string, DataList> entry in paramMap) { + DataList dataList = entry.Value; + List<Data> paramList = new List<Data>(); + for (int i = 0; i < dataList.size(); i++) { + Data data = dataList.get(i); + paramList.Add(data); + } + parameters.Add(entry.Key, paramList); + } + return parameters; + } + + public void setParams(Dictionary<string, List<Data>> parameters) { + ParamMap paramMap = new ParamMap(); + foreach(KeyValuePair<string, List<Data>> entry in parameters) { + DataList dataList = new DataList(); + foreach (Data data in entry.Value) { + dataList.add(data); + } + paramMap.Add(entry.Key, dataList); + } + setParamMap(paramMap); + } + + public Dictionary<string, Data> getNameList() { + Dictionary<string, Data> nameList = new Dictionary<string, Data>(); + DataMap nameListMap = getNameListNative(); + StringVector nameListMapKeys = getNameListKeys(); + for (int i = 0; i < nameListMapKeys.Count; i++) { + nameList[nameListMapKeys[i]] = nameListMap[nameListMapKeys[i]]; + } + return nameList; + } + + public void setNameList(Dictionary<string, Data> nameList) { + DataMap dataMap = new DataMap(); + foreach (KeyValuePair<string, Data> entry in nameList) { + dataMap.Add(entry); + } + setNameListNative(dataMap); + } +%} + //*********************************************** // Parse the header file to generate wrappers //*********************************************** @@ -164,8 +302,7 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret); %template(StringSet) std::set<std::string>; %template(StringVector) std::vector<std::string>; %template(StringList) std::list<std::string>; -%template(ParamPair) std::pair<std::string, uscxml::Data>; -%template(ParamPairVector) std::vector<std::pair<std::string, uscxml::Data> >; -%template(IOProcMap) std::map<std::string, uscxml::IOProcessor>; -%template(InvokerMap) std::map<std::string, uscxml::Invoker>; +%template(ParamMap) std::map<std::string, std::list<uscxml::Data> >; +%template(IOProcMap) std::map<std::string, IOProcessor>; +%template(InvokerMap) std::map<std::string, Invoker>; %template(ParentQueue) uscxml::concurrency::BlockingQueue<uscxml::SendRequest>; diff --git a/src/bindings/swig/java/org/uscxml/Data.java b/src/bindings/swig/java/org/uscxml/Data.java deleted file mode 100644 index 7781f47..0000000 --- a/src/bindings/swig/java/org/uscxml/Data.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.uscxml; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class Data { - public Map<String, Data> compound = new HashMap<String, Data>(); - public List<Data> array = new LinkedList<Data>(); - public String atom; - public Type type = Type.INTERPRETED; - - public enum Type { - VERBATIM, INTERPRETED - } - - public static Data fromJSON(String jsonString) { - return new Data(DataNative.fromJSON(jsonString)); - } - - public Data() { - } - - public Data(String atom, Data.Type type) { - this.atom = atom; - this.type = type; - } - - public Data(DataNative nativeData) { - if (!nativeData.getCompound().empty()) { - // data is a key value compound - StringVector keys = nativeData.getCompundKeys(); - for(int i = 0; i < keys.size(); i++) { - this.compound.put(keys.get(i), new Data(nativeData.getCompound().get(keys.get(i)))); - } - } else if (!nativeData.getArray().isEmpty()) { - // data is an array - for (int i = 0; i < nativeData.getArray().size(); i++) { - this.array.add(new Data(nativeData.getArray().get(i))); - } - } else { - // data is a single atom - this.atom = nativeData.getAtom(); - if (nativeData.getType() == DataNative.Type.INTERPRETED) { - this.type = Type.INTERPRETED; - } else { - this.type = Type.VERBATIM; - } - } - } - - @Override - public String toString() { - return toJSON(); - } - - public String toJSON() { - DataNative nativeData = toNative(this); - return DataNative.toJSON(nativeData); - } - - public static DataNative toNative(Data data) { - DataNative nativeData = new DataNative(); - //nativeData.swigCMemOwn = false; - if (data.compound != null && !data.compound.isEmpty()) { - DataMap nativeDataMap = new DataMap(); - for (String key : data.compound.keySet()) { - nativeDataMap.set(key, toNative(data.compound.get(key))); - } - nativeData.setCompound(nativeDataMap); - } else if (data.array != null && !data.array.isEmpty()) { - DataList nativeDataList = new DataList(); - for (Data item : data.array) { - nativeDataList.add(toNative(item)); - } - nativeData.setArray(nativeDataList); - } else if (data.atom != null) { - nativeData.setAtom(data.atom); - if (data.type == Type.INTERPRETED) { - nativeData.setType(DataNative.Type.INTERPRETED); - } else { - nativeData.setType(DataNative.Type.VERBATIM); - } - } - return nativeData; - } - -} diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i index 880b02d..cb760e4 100644 --- a/src/bindings/swig/java/uscxml.i +++ b/src/bindings/swig/java/uscxml.i @@ -12,10 +12,19 @@ %include <boost_shared_ptr.i> +// these are needed at least for the templates to work typedef uscxml::Data Data; typedef uscxml::Event Event; typedef uscxml::InvokeRequest InvokeRequest; typedef uscxml::SendRequest SendRequest; +typedef uscxml::Invoker Invoker; +typedef uscxml::IOProcessor IOProcessor; +typedef uscxml::DataModel DataModel; +typedef uscxml::ExecutableContent ExecutableContent; +typedef uscxml::InvokerImpl InvokerImpl; +typedef uscxml::IOProcessorImpl IOProcessorImpl; +typedef uscxml::DataModelImpl DataModelImpl; +typedef uscxml::ExecutableContentImpl ExecutableContentImpl; %feature("director") uscxml::WrappedInvoker; %feature("director") uscxml::WrappedDataModel; @@ -33,7 +42,6 @@ typedef uscxml::SendRequest SendRequest; %rename(equals) operator==; %rename(isValid) operator bool; - //************************************************** // This ends up in the generated wrapper code //************************************************** @@ -54,6 +62,7 @@ typedef uscxml::SendRequest SendRequest; using namespace uscxml; using namespace Arabica::DOM; +// the wrapped* C++ classes get rid of DOM nodes and provide more easily wrapped base classes #include "../wrapped/WrappedInvoker.cpp" #include "../wrapped/WrappedDataModel.cpp" #include "../wrapped/WrappedExecutableContent.cpp" @@ -86,11 +95,202 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret); %include "../uscxml_ignores.i" -%rename Data DataNative; +// see http://swig.org/Doc2.0/Java.html#Java_date_marshalling +%define BEAUTIFY_NATIVE( MATCH, WRAPPER, NATIVE ) + +%rename WRAPPER NATIVE; + +%typemap(jstype) const MATCH & "WRAPPER" +%typemap(jstype) MATCH "WRAPPER" + +%typemap(javain, + pre=" NATIVE temp$javainput = $javainput.toNative();", + pgcppname="temp$javainput") const MATCH & + "$javaclassname.getCPtr(temp$javainput)" + + %typemap(javain, + pre=" NATIVE temp$javainput = $javainput.toNative();", + pgcppname="temp$javainput") MATCH + "$javaclassname.getCPtr(temp$javainput)" + +%typemap(javaout) const MATCH & { + NATIVE nativeData = new NATIVE($jnicall, $owner); + return new WRAPPER(nativeData); +} + +%typemap(javaout) MATCH { + NATIVE nativeData = new NATIVE($jnicall, $owner); + return new WRAPPER(nativeData); +} + +%typemap(javadirectorout) MATCH "NATIVE.getCPtr($javacall.toNative())" + +%typemap(javadirectorin) MATCH "WRAPPER.fromNative(new NATIVE($jniinput, false))"; +%typemap(javadirectorin) const MATCH & "WRAPPER.fromNative(new NATIVE($jniinput, false))"; + +%typemap(directorin,descriptor="L/org/uscxml/"##"WRAPPER;") const MATCH & "*(MATCH **)&$input = (MATCH *) &$1;" + +%typemap(directorout) MATCH ($&1_type argp) +%{ argp = *($&1_ltype*)&$input; + if (!argp) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type"); + return $null; + } + $result = *argp; %} + +%enddef + +/* +// not used as it will not work for directors :( +BEAUTIFY_NATIVE(uscxml::Data, Data, DataNative); +BEAUTIFY_NATIVE(uscxml::Event, Event, EventNative); +BEAUTIFY_NATIVE(uscxml::SendRequest, SendRequest, SendRequestNative); +BEAUTIFY_NATIVE(uscxml::InvokeRequest, InvokeRequest, InvokeRequestNative); +*/ + + +//*********************************************** +// Beautify important classes +//*********************************************** %include "../uscxml_beautify.i" +%rename(getCompoundNative) uscxml::Data::getCompound(); +%rename(getArrayNative) uscxml::Data::getArray(); +%rename(setCompoundNative) uscxml::Data::setCompound(const std::map<std::string, Data>&); +%rename(setArrayNative) uscxml::Data::setArray(const std::list<Data>&); +%javamethodmodifiers uscxml::Data::getCompound() "private"; +%javamethodmodifiers uscxml::Data::getArray() "private"; +%javamethodmodifiers uscxml::Data::setCompound(const std::map<std::string, Data>&) "private"; +%javamethodmodifiers uscxml::Data::setArray(const std::list<Data>&) "private"; +%javamethodmodifiers uscxml::Data::getCompoundKeys() "private"; + +%typemap(javaimports) uscxml::Data %{ +import java.util.Map; +import java.util.HashMap; +import java.util.List; +import java.util.LinkedList; +%} + +%typemap(javacode) uscxml::Data %{ + public Data(Map<String, Data> compound) { + this(uscxmlNativeJavaJNI.new_Data__SWIG_0(), true); + setCompound(compound); + } + + public Data(List<Data> array) { + this(uscxmlNativeJavaJNI.new_Data__SWIG_0(), true); + setArray(array); + } + + public Map<String, Data> getCompound() { + Map<String, Data> compound = new HashMap<String, Data>(); + DataMap dataMap = getCompoundNative(); + StringVector dataMapKeys = getCompoundKeys(); + for (int i = 0; i < dataMapKeys.size(); i++) { + compound.put(dataMapKeys.get(i), dataMap.get(dataMapKeys.get(i))); + } + return compound; + } + + public void setCompound(Map<String, Data> compound) { + DataMap dataMap = new DataMap(); + for (String key : compound.keySet()) { + dataMap.set(key, compound.get(key)); + } + setCompoundNative(dataMap); + } + + public List<Data> getArray() { + List<Data> array = new LinkedList<Data>(); + DataList dataList = getArrayNative(); + for (int i = 0; i < dataList.size(); i++) { + array.add(dataList.get(i)); + } + return array; + } + + public void setArray(List<Data> array) { + DataList dataList = new DataList(); + for (Data data : array) { + dataList.add(data); + } + setArrayNative(dataList); + } + +%} + +%rename(getNameListNative) uscxml::Event::getNameList(); +%rename(getParamstNative) uscxml::Event::getParams(); +%rename(setNameListNative) uscxml::Event::setNameList(const std::map<std::string, Data>&); +%rename(setParamsNative) uscxml::Event::setParams(const std::multimap<std::string, Data>&); +%javamethodmodifiers uscxml::Event::getNameList() "private"; +%javamethodmodifiers uscxml::Event::getNameListKeys() "private"; +%javamethodmodifiers uscxml::Event::getParams() "private"; +%javamethodmodifiers uscxml::Event::setNameList(const std::map<std::string, Data>&) "private"; +%javamethodmodifiers uscxml::Event::setParams(const std::multimap<std::string, Data>&) "private"; + +%typemap(javaimports) uscxml::Event %{ +import java.util.Map; +import java.util.HashMap; +import java.util.List; +import java.util.LinkedList; +%} + +%typemap(javacode) uscxml::Event %{ + public Map<String, List<Data>> getParams() { + Map<String, List<Data>> params = new HashMap<String, List<Data>>(); + ParamMap paramMap = getParamMap(); + StringVector paramMapKeys = getParamMapKeys(); + + for (int i = 0; i < paramMapKeys.size(); i++) { + String key = paramMapKeys.get(i); + DataList dataList = paramMap.get(key); + + for (int j = 0; j < dataList.size(); j++) { + Data data = dataList.get(j); + if (!params.containsKey(key)) + params.put(key, new LinkedList<Data>()); + params.get(key).add(data); + } + } + return params; + } + + public void setParams(Map<String, List<Data>> params) { + ParamMap paramMap = new ParamMap(); + for (String key : params.keySet()) { + DataList datalist = new DataList(); + for (Data data : params.get(key)) { + datalist.add(data); + } + paramMap.set(key, datalist); + } + setParamMap(paramMap); + } + + public Map<String, Data> getNameList() { + Map<String, Data> namelist = new HashMap<String, Data>(); + StringVector nameMapKeys = getNameListKeys(); + DataMap nameMap = getNameListNative(); + + for (int i = 0; i < nameMapKeys.size(); i++) { + namelist.put(nameMapKeys.get(i), nameMap.get(nameMapKeys.get(i))); + } + return namelist; + } + + public void setNameList(Map<String, Data> namelist) { + DataMap nameListMap = new DataMap(); + for (String key : namelist.keySet()) { + nameListMap.set(key, namelist.get(key)); + } + setNameListNative(nameListMap); + } +%} + + //*********************************************** // Parse the header file to generate wrappers //*********************************************** @@ -125,8 +325,7 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret); %template(StringSet) std::set<std::string>; %template(StringVector) std::vector<std::string>; %template(StringList) std::list<std::string>; -%template(ParamPair) std::pair<std::string, uscxml::Data>; -%template(ParamPairVector) std::vector<std::pair<std::string, uscxml::Data> >; -%template(IOProcMap) std::map<std::string, uscxml::IOProcessor>; -%template(InvokerMap) std::map<std::string, uscxml::Invoker>; +%template(ParamMap) std::map<std::string, std::list<uscxml::Data> >; +%template(IOProcMap) std::map<std::string, IOProcessor>; +%template(InvokerMap) std::map<std::string, Invoker>; %template(ParentQueue) uscxml::concurrency::BlockingQueue<uscxml::SendRequest>; diff --git a/src/bindings/swig/uscxml_beautify.i b/src/bindings/swig/uscxml_beautify.i index 8a53fbb..ac3ed44 100644 --- a/src/bindings/swig/uscxml_beautify.i +++ b/src/bindings/swig/uscxml_beautify.i @@ -9,15 +9,76 @@ %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; - std::multimap<std::string, Data>::iterator paramPairIter = self->getParams().begin(); +%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; + } + + 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(); + } + + 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(); while(paramPairIter != self->getParams().end()) { - pairs.push_back(*paramPairIter); + paramMap[paramPairIter->first].push_back(paramPairIter->second); paramPairIter++; } - return pairs; + return paramMap; + } + + std::vector<std::string> getParamMapKeys() { + std::vector<std::string> keys; + for(std::multimap<std::string, Data>::const_iterator iter = self->getParams().begin(); + iter != self->getParams().end(); + iter = self->getParams().upper_bound(iter->first)) { + keys.push_back(iter->first); + } + return keys; + } + + void setParamMap(const std::map<std::string, std::list<uscxml::Data> >& paramMap) { + std::multimap<std::string, Data> params; + std::map<std::string, std::list<uscxml::Data> >::const_iterator mapIter = paramMap.begin(); + while(mapIter != paramMap.end()) { + std::list<uscxml::Data>::const_iterator dataIter = mapIter->second.begin(); + while(dataIter != mapIter->second.end()) { + params.insert(std::make_pair(mapIter->first, *dataIter)); + dataIter++; + } + mapIter++; + } + self->setParams(params); + } + + std::vector<std::string> getNameListKeys() { + std::vector<std::string> keys; + std::map<std::string, Data>::const_iterator iter = self->getNameList().begin(); + while(iter != self->getNameList().end()) { + keys.push_back(iter->first); + iter++; + } + return keys; } }; @@ -66,7 +127,13 @@ }; %extend uscxml::Data { - std::vector<std::string> getCompundKeys() { + 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(); while(iter != self->compound.end()) { @@ -76,3 +143,19 @@ 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/uscxml_ignores.i b/src/bindings/swig/uscxml_ignores.i index c5bf88b..d54dae2 100644 --- a/src/bindings/swig/uscxml_ignores.i +++ b/src/bindings/swig/uscxml_ignores.i @@ -21,7 +21,6 @@ %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>); @@ -180,6 +179,11 @@ %ignore uscxml::Event::toDocument(); %ignore uscxml::Event::getParams(); %ignore uscxml::Event::getParam; +%ignore uscxml::Event::setParams; + +%ignore uscxml::SendRequest::fromXML; +%ignore uscxml::InvokeRequest::fromXML; + // Data diff --git a/src/bindings/swig/wrapped/WrappedDataModel.h b/src/bindings/swig/wrapped/WrappedDataModel.h index 013f22c..e1b29af 100644 --- a/src/bindings/swig/wrapped/WrappedDataModel.h +++ b/src/bindings/swig/wrapped/WrappedDataModel.h @@ -46,6 +46,7 @@ public: _interpreter = interpreter->shared_from_this(); return boost::shared_ptr<DataModelImpl>(create(_interpreter)); } + virtual std::list<std::string> getNames() { return std::list<std::string>(); }; diff --git a/src/bindings/swig/wrapped/WrappedExecutableContent.h b/src/bindings/swig/wrapped/WrappedExecutableContent.h index e00704a..b1ce4f9 100644 --- a/src/bindings/swig/wrapped/WrappedExecutableContent.h +++ b/src/bindings/swig/wrapped/WrappedExecutableContent.h @@ -72,11 +72,9 @@ public: } virtual void enterElement(const std::string& node) { - } virtual void exitElement(const std::string& node) { - } private: diff --git a/src/bindings/swig/wrapped/WrappedIOProcessor.h b/src/bindings/swig/wrapped/WrappedIOProcessor.h index 1d134dc..b4e4938 100644 --- a/src/bindings/swig/wrapped/WrappedIOProcessor.h +++ b/src/bindings/swig/wrapped/WrappedIOProcessor.h @@ -47,6 +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>(); }; diff --git a/src/bindings/swig/wrapped/WrappedInvoker.h b/src/bindings/swig/wrapped/WrappedInvoker.h index b3ff200..6251c6e 100644 --- a/src/bindings/swig/wrapped/WrappedInvoker.h +++ b/src/bindings/swig/wrapped/WrappedInvoker.h @@ -50,6 +50,7 @@ public: virtual void send(const SendRequest& req) {} virtual void invoke(const InvokeRequest& req) {} + virtual void uninvoke() {} virtual WrappedInvoker* create(Interpreter interpreter) { return new WrappedInvoker(); |