%rename(NativeDataModel) DataModel; %rename(DataModel) WrappedDataModel; %rename(NativeDataModelExtension) DataModelExtension; %rename(DataModelExtension) WrappedDataModelExtension; %rename(NativeExecutableContent) ExecutableContent; %rename(ExecutableContent) WrappedExecutableContent; %rename(NativeInvoker) Invoker; %rename(Invoker) WrappedInvoker; %rename(NativeIOProcessor) IOProcessor; %rename(IOProcessor) WrappedIOProcessor; %rename(NativeInterpreterMonitor) InterpreterMonitor; %rename(InterpreterMonitor) WrappedInterpreterMonitor; %rename(getInvokersNative) uscxml::Interpreter::getInvokers(); %rename(getIOProcessorsNative) uscxml::Interpreter::getIOProcessors(); %extend uscxml::Event { std::map > getParamMap() { std::map > paramMap; std::multimap::const_iterator paramPairIter = self->getParams().begin(); while(paramPairIter != self->getParams().end()) { paramMap[paramPairIter->first].push_back(paramPairIter->second); paramPairIter++; } return paramMap; } std::vector getParamMapKeys() { std::vector keys; for(std::multimap::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 >& paramMap) { std::multimap params; std::map >::const_iterator mapIter = paramMap.begin(); while(mapIter != paramMap.end()) { std::list::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 getNameListKeys() { std::vector keys; std::map::const_iterator iter = self->getNameList().begin(); while(iter != self->getNameList().end()) { keys.push_back(iter->first); iter++; } return keys; } }; %extend uscxml::Interpreter { void addIOProcessor(uscxml::WrappedIOProcessor* ioProc) { self->addIOProcessor(boost::shared_ptr(ioProc)); } void setDataModel(uscxml::WrappedDataModel* dataModel) { self->setDataModel(boost::shared_ptr(dataModel)); } void setInvoker(const std::string invokeId, uscxml::WrappedInvoker* invoker) { self->setInvoker(invokeId, boost::shared_ptr(invoker)); } std::vector getBasicConfiguration() { Arabica::XPath::NodeSet nativeConfig = self->getBasicConfiguration(); std::vector config; for (int i = 0; i < nativeConfig.size(); i++) { Arabica::DOM::Element elem(nativeConfig[i]); config.push_back(elem.getAttribute("id")); } return config; } std::vector getConfiguration() { Arabica::XPath::NodeSet nativeConfig = self->getConfiguration(); std::vector config; for (int i = 0; i < nativeConfig.size(); i++) { Arabica::DOM::Element elem(nativeConfig[i]); config.push_back(elem.getAttribute("id")); } return config; } std::vector getIOProcessorKeys() { std::vector keys; std::map::const_iterator iter = self->getIOProcessors().begin(); while(iter != self->getIOProcessors().end()) { keys.push_back(iter->first); iter++; } return keys; } std::vector getInvokerKeys() { std::vector keys; std::map::const_iterator iter = self->getInvokers().begin(); while(iter != self->getInvokers().end()) { keys.push_back(iter->first); iter++; } return keys; } }; %{ #include #include "uscxml/dom/NameSpacingParser.h" %} %extend uscxml::Data { std::vector getCompoundKeys() { std::vector keys; std::map::const_iterator iter = self->compound.begin(); while(iter != self->compound.end()) { keys.push_back(iter->first); iter++; } return keys; } std::string getXML() { if (!self->node) return ""; std::stringstream ss; ss << self->node; return ss.str(); } void setXML(const std::string& xml) { NameSpacingParser parser = NameSpacingParser::fromXML(xml); if (!parser.errorsReported()) { self->node = parser.getDocument(); } else { LOG(ERROR) << "Cannot parse message as XML: " << parser.errors(); } } };