summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig/csharp/uscxml.i
blob: 07604c4d5926da99bb96a8e3574fbf9d2987b3b1 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
%module(directors="1", allprotected="1") uscxmlNativeCSharp

// provide a macro for the header files
#define SWIGIMPORTED 1

// import swig typemaps
//%include <inttypes.i>

%include <stl.i>
%include <std_map.i>
%include <std_string.i>
%include <inttypes.i>
%include "../stl_set.i"
%include "../stl_list.i"

%include <boost_shared_ptr.i>

typedef uscxml::Data Data;
typedef uscxml::Event Event;
typedef uscxml::InvokeRequest InvokeRequest;
typedef uscxml::SendRequest SendRequest;

// disable warning related to unknown base class
#pragma SWIG nowarn=401
//%ignore boost::enable_shared_from_this;

%csconst(1);

# %shared_ptr(uscxml::dom::Element);
# %shared_ptr(uscxml::dom::Executable);

%rename(equals) operator==; 
%rename(isValid) operator bool;
%ignore operator!=;
%ignore operator<;
%ignore operator=;
%ignore operator[];
%ignore operator std::list<Data>;
%ignore operator std::string;
%ignore operator std::map<std::string,Data>;
%ignore operator<<;


//**************************************************
// This ends up in the generated wrapper code
//**************************************************

%{

#include "../../../uscxml/Message.h"
#include "../../../uscxml/Factory.h"
#include "../../../uscxml/Interpreter.h"

//#include <DOM/Document.hpp>
//#include <DOM/Node.hpp>
//#include <DOM/Element.hpp>
//#include <DOM/Attr.hpp>
//#include <DOM/Text.hpp>

#include "../wrapped/WrappedInvoker.h"
#include "../wrapped/WrappedDataModel.h"

using namespace uscxml;
using namespace Arabica::DOM;

#include "../wrapped/WrappedInvoker.cpp"
#include "../wrapped/WrappedDataModel.cpp"

%}

%ignore uscxml::NumAttr;
%ignore uscxml::SCXMLParser;
%ignore uscxml::InterpreterImpl;

%ignore create();

%ignore uscxml::Interpreter::getDelayQueue();

%ignore uscxml::WrappedInvoker::create(InterpreterImpl*);

%ignore uscxml::WrappedDataModel::create(InterpreterImpl*);
%ignore uscxml::WrappedDataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
%ignore uscxml::WrappedDataModel::init(const std::string&, const Data&);
%ignore uscxml::WrappedDataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
%ignore uscxml::WrappedDataModel::assign(const std::string&, const Data&);
%ignore uscxml::WrappedDataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);

%ignore uscxml::Event::Event(const Arabica::DOM::Node<std::string>&);
%ignore uscxml::Event::getStrippedDOM;
%ignore uscxml::Event::getFirstDOMElement;
%ignore uscxml::Event::getDOM();
%ignore uscxml::Event::setDOM(const Arabica::DOM::Document<std::string>&);
%ignore uscxml::Event::toDocument();

%template(DataList) std::list<uscxml::Data>;
%template(DataMap) std::map<std::string, uscxml::Data>;
%template(StringSet) std::set<std::string>;
%template(StringVector) std::vector<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>;

%rename Data DataNative;

%feature("director") uscxml::WrappedInvoker;
%feature("director") uscxml::WrappedDataModel;

// translate param multimap to Map<String, List<Data> >
%rename(getParamsNative) uscxml::Event::getParams();
%csmethodmodifiers uscxml::Event::getParams() "private";

%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();
		while(paramPairIter != self->getParams().end()) {
			pairs.push_back(*paramPairIter);
			paramPairIter++;
		}
		return pairs;
	}
};

%extend uscxml::Interpreter {
	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> getCompundKeys() {
		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;
	}
};



//***********************************************
// Parse the header file to generate wrappers
//***********************************************

%include "../../../uscxml/Common.h"
%include "../../../uscxml/Factory.h"
%include "../../../uscxml/Message.h"
%include "../../../uscxml/Interpreter.h"
#include "../../../uscxml/DOMUtils.h"

# %include <DOM/Document.hpp>
# %include <DOM/Node.hpp>
# %include <DOM/Element.hpp>
# %include <DOM/Attr.hpp>
# %include <DOM/Text.hpp>

%include "../wrapped/WrappedInvoker.h"
%include "../wrapped/WrappedDataModel.h"

# %template(XMLDocument) Arabica::DOM::Document<std::string>;
# %template(XMLNode) Arabica::DOM::Node<std::string>;
# %template(XMLElement) Arabica::DOM::Element<std::string>;
# %template(XMLAttr) Arabica::DOM::Attr<std::string>;
# %template(XMLText) Arabica::DOM::Text<std::string>;