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
|
%module(directors="1") uscxmlNativePython
// provide a macro for the header files
#define SWIGIMPORTED 1
%include <stl.i>
%include <std_map.i>
%include <std_string.i>
// the std_list.i from SWIG 3.0.10 fails to generate valid c++ code?
/*%include <std_list.i>*/
%include "../stl_list.i"
%include <std_set.i>
%include <inttypes.i>
// these are needed at least for the templates to work
typedef uscxml::Blob Blob;
typedef uscxml::Data Data;
typedef uscxml::Event Event;
typedef uscxml::Invoker Invoker;
typedef uscxml::IOProcessor IOProcessor;
typedef uscxml::DataModel DataModel;
typedef uscxml::DataModelExtension DataModelExtension;
typedef uscxml::ExecutableContent ExecutableContent;
typedef uscxml::InvokerImpl InvokerImpl;
typedef uscxml::IOProcessorImpl IOProcessorImpl;
typedef uscxml::DataModelImpl DataModelImpl;
typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
typedef uscxml::InterpreterIssue InterpreterIssue;
%feature("director") uscxml::WrappedInvoker;
%feature("director") uscxml::WrappedDataModel;
%feature("director") uscxml::WrappedDataModelExtension;
%feature("director") uscxml::WrappedIOProcessor;
%feature("director") uscxml::WrappedExecutableContent;
%feature("director") uscxml::WrappedInterpreterMonitor;
// disable warning related to unknown base class
#pragma SWIG nowarn=401
// do not warn when we override symbols via extend
#pragma SWIG nowarn=302
// do not warn when ignoring overrided method
#pragma SWIG nowarn=516
%rename(equals) operator==; // signature is wrong, still useful
%rename(isValid) operator bool;
//**************************************************
// This ends up in the generated wrapper code
//**************************************************
%{
#include "uscxml/config.h"
#include "../../../uscxml/Interpreter.h"
#include "../../../uscxml/debug/InterpreterIssue.h"
#include "../../../uscxml/interpreter/InterpreterState.h"
#include "../../../uscxml/interpreter/InterpreterMonitor.h"
#include "../../../uscxml/messages/Data.h"
#include "../../../uscxml/messages/Event.h"
#include "../../../uscxml/util/DOM.h"
#include "../../../uscxml/plugins/Factory.h"
#include "../../../uscxml/plugins/DataModelImpl.h"
#include "../wrapped/WrappedInvoker.h"
#include "../wrapped/WrappedDataModel.h"
#include "../wrapped/WrappedActionLanguage.h"
#include "../wrapped/WrappedExecutableContent.h"
#include "../wrapped/WrappedIOProcessor.h"
#include "../wrapped/WrappedInterpreterMonitor.h"
using namespace uscxml;
using namespace XERCESC_NS;
// 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/WrappedActionLanguage.cpp"
#include "../wrapped/WrappedExecutableContent.cpp"
#include "../wrapped/WrappedIOProcessor.cpp"
#include "../wrapped/WrappedInterpreterMonitor.cpp"
%}
%include "../uscxml_ignores.i"
// bytearray for Blob::data
// see: http://stackoverflow.com/questions/9934059/swig-technique-to-wrap-unsigned-binary-data
#if 0
%apply (char *STRING, size_t LENGTH) { (const char* data, size_t size) };
%typemap(jni) char* getData "jbyteArray"
%typemap(jtype) char* getData "byte[]"
%typemap(jstype) char* getData "byte[]"
%typemap(javaout) char* getData {
return $jnicall;
}
%typemap(out) char* getData {
$result = JCALL1(NewByteArray, jenv, ((uscxml::Blob const *)arg1)->getSize());
JCALL4(SetByteArrayRegion, jenv, $result, 0, ((uscxml::Blob const *)arg1)->getSize(), (jbyte *)$1);
}
#endif
//***********************************************
// Beautify important classes
//***********************************************
%include "../uscxml_beautify.i"
//***********************************************
// Parse the header file to generate wrappers
//***********************************************
%include "../../../uscxml/Common.h"
%include "../../../uscxml/messages/Blob.h"
%include "../../../uscxml/messages/Data.h"
%include "../../../uscxml/messages/Event.h"
%include "../../../uscxml/plugins/Factory.h"
%include "../../../uscxml/interpreter/InterpreterState.h"
%include "../../../uscxml/interpreter/InterpreterMonitor.h"
//%include "../../../uscxml/interpreter/MicroStep.h"
//%include "../../../uscxml/interpreter/ContentExecutor.h"
%include "../../../uscxml/Interpreter.h"
%include "../../../uscxml/debug/InterpreterIssue.h"
%include "../../../uscxml/plugins/EventHandler.h"
%include "../../../uscxml/plugins/DataModel.h"
%include "../../../uscxml/plugins/DataModelImpl.h"
%include "../../../uscxml/plugins/ExecutableContent.h"
%include "../../../uscxml/plugins/ExecutableContentImpl.h"
%include "../../../uscxml/plugins/Invoker.h"
%include "../../../uscxml/plugins/InvokerImpl.h"
%include "../../../uscxml/plugins/IOProcessor.h"
%include "../../../uscxml/plugins/IOProcessorImpl.h"
%include "../wrapped/WrappedInvoker.h"
%include "../wrapped/WrappedDataModel.h"
%include "../wrapped/WrappedActionLanguage.h"
%include "../wrapped/WrappedExecutableContent.h"
%include "../wrapped/WrappedIOProcessor.h"
%include "../wrapped/WrappedInterpreterMonitor.h"
%template(IssueList) std::list<uscxml::InterpreterIssue>;
%template(DataList) std::list<uscxml::Data>;
%template(StringList) std::list<std::string>;
%template(DataMap) std::map<std::string, uscxml::Data>;
%template(StringSet) std::set<std::string>;
%template(StringVector) std::vector<std::string>;
%template(ParamMap) std::map<std::string, std::list<uscxml::Data> >;
%template(IOProcMap) std::map<std::string, IOProcessor>;
%template(InvokerMap) std::map<std::string, Invoker>;
|