summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig/uscxml_beautify.i
blob: 4f3d24675356b0069e923dcd427cd829e33c6d2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
%rename(NativeDataModel) DataModel;
%rename(DataModel) WrappedDataModel;
%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<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()) {
			paramMap[paramPairIter->first].push_back(paramPairIter->second);
			paramPairIter++;
		}
		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;
	}
};

%extend uscxml::Interpreter {
	
	void addIOProcessor(uscxml::WrappedIOProcessor* ioProc) {
		self->addIOProcessor(boost::shared_ptr<IOProcessorImpl>(ioProc));
	}

	void setDataModel(WrappedDataModel* dataModel) {
		self->setDataModel(boost::shared_ptr<DataModelImpl>(dataModel));
	}

	void setInvoker(const std::string invokeId, uscxml::WrappedInvoker* invoker) {
		self->setInvoker(invokeId, boost::shared_ptr<InvokerImpl>(invoker));
	}
	
	std::vector<std::string> getBasicConfiguration() {
		Arabica::XPath::NodeSet<std::string> nativeConfig = self->getBasicConfiguration();
		std::vector<std::string> config;
		for (int i = 0; i < nativeConfig.size(); i++) {
			Arabica::DOM::Element<std::string> elem(nativeConfig[i]);
			config.push_back(elem.getAttribute("id"));
		}
		return config;
	}

	std::vector<std::string> getConfiguration() {
		Arabica::XPath::NodeSet<std::string> nativeConfig = self->getConfiguration();
		std::vector<std::string> config;
		for (int i = 0; i < nativeConfig.size(); i++) {
			Arabica::DOM::Element<std::string> elem(nativeConfig[i]);
			config.push_back(elem.getAttribute("id"));
		}
		return config;
	}
		
	std::vector<std::string> getIOProcessorKeys() {
		std::vector<std::string> keys;
    std::map<std::string, IOProcessor>::const_iterator iter = self->getIOProcessors().begin();
		while(iter != self->getIOProcessors().end()) {
			keys.push_back(iter->first);
			iter++;
		}
		return keys;
	}

	std::vector<std::string> getInvokerKeys() {
		std::vector<std::string> keys;
    std::map<std::string, Invoker>::const_iterator iter = self->getInvokers().begin();
		while(iter != self->getInvokers().end()) {
			keys.push_back(iter->first);
			iter++;
		}
		return keys;
	}

};

%extend uscxml::Data {
	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()) {
			keys.push_back(iter->first);
			iter++;
		}
		return keys;
	}
};