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/uscxml_beautify.i | |
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/uscxml_beautify.i')
-rw-r--r-- | src/bindings/swig/uscxml_beautify.i | 97 |
1 files changed, 90 insertions, 7 deletions
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 |