oboe 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2012 Tracelytics, Inc. All Rights Reserved. The
2
+ software made available to you by Tracelytics, Inc. and/or through
3
+ your use of tracelytics.com is licensed pursuant to the Terms of
4
+ Service: http://www.tracelytics.com/terms-of-service/
@@ -0,0 +1,20 @@
1
+ # Copyright (c) 2012 by Tracelytics, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'mkmf'
5
+
6
+ if have_library('oboe')
7
+ $libs = append_library($libs, "oboe")
8
+ $libs = append_library($libs, "stdc++")
9
+
10
+ $CFLAGS << " #{ENV["CFLAGS"]}"
11
+ $CPPFLAGS << " #{ENV["CPPFLAGS"]}"
12
+ $LIBS << " #{ENV["LIBS"]}"
13
+
14
+ cpp_command('g++') if RUBY_VERSION < '1.9'
15
+ create_makefile('oboe_metal', 'src')
16
+ else
17
+ $stderr.puts "Error: Could not find the base liboboe libraries. No tracing will occur."
18
+ create_makefile('oboe_noop', 'noop')
19
+ end
20
+
@@ -0,0 +1,7 @@
1
+ #include <ruby.h>
2
+
3
+ /* ruby calls this to load the extension */
4
+ void Init_oboe_noop(void) {
5
+ /* assume we haven't yet defined Hola */
6
+ VALUE klass = rb_define_class("OboeNoop", rb_cObject);
7
+ }
@@ -0,0 +1,256 @@
1
+ // Copyright (c) 2012 by Tracelytics, Inc.
2
+ // All rights reserved.
3
+
4
+ #ifndef OBOE_HPP
5
+ #define OBOE_HPP
6
+
7
+ #include <string>
8
+ #include <oboe/oboe.h>
9
+
10
+ // oboe prefix added in liboboe 1.0
11
+ #ifndef MAX_METADATA_PACK_LEN
12
+ #define MAX_METADATA_PACK_LEN OBOE_MAX_METADATA_PACK_LEN
13
+ #endif
14
+
15
+ class Event;
16
+
17
+ class Metadata : private oboe_metadata_t {
18
+ friend class UdpReporter;
19
+ friend class FileReporter;
20
+ friend class Context;
21
+
22
+ public:
23
+ Metadata(oboe_metadata_t *md) {
24
+ oboe_metadata_copy(this, md);
25
+ }
26
+
27
+ ~Metadata() {
28
+ oboe_metadata_destroy(this);
29
+ }
30
+
31
+ static Metadata* fromString(std::string s) {
32
+ oboe_metadata_t md;
33
+ oboe_metadata_fromstr(&md, s.data(), s.size());
34
+ return new Metadata(&md); // copies md
35
+ }
36
+
37
+ // these new objects are managed by SWIG %newobject
38
+ Event *createEvent();
39
+
40
+ static Metadata *makeRandom() {
41
+ oboe_metadata_t md;
42
+ oboe_metadata_init(&md);
43
+ oboe_metadata_random(&md);
44
+ return new Metadata(&md); // copies md
45
+ }
46
+
47
+ Metadata *copy() {
48
+ return new Metadata(this);
49
+ }
50
+
51
+ bool isValid() {
52
+ return oboe_metadata_is_valid(this);
53
+ }
54
+
55
+ #ifdef SWIGJAVA
56
+ std::string toStr() {
57
+ #else
58
+ std::string toString() {
59
+ #endif
60
+ char buf[MAX_METADATA_PACK_LEN];
61
+
62
+ int rc = oboe_metadata_tostr(this, buf, sizeof(buf) - 1);
63
+ if (rc == 0) {
64
+ return std::string(buf);
65
+ } else {
66
+ return std::string(); // throw exception?
67
+ }
68
+ }
69
+
70
+ };
71
+
72
+ class Context {
73
+ public:
74
+ // returns pointer to current context (from thread-local storage)
75
+ static oboe_metadata_t *get() {
76
+ return oboe_context_get();
77
+ }
78
+
79
+ #ifdef SWIGJAVA
80
+ static std::string toStr() {
81
+ #else
82
+ static std::string toString() {
83
+ #endif
84
+ char buf[MAX_METADATA_PACK_LEN];
85
+
86
+ oboe_metadata_t *md = Context::get();
87
+ int rc = oboe_metadata_tostr(md, buf, sizeof(buf) - 1);
88
+ if (rc == 0) {
89
+ return std::string(buf);
90
+ } else {
91
+ return std::string(); // throw exception?
92
+ }
93
+ }
94
+
95
+ static void set(oboe_metadata_t *md) {
96
+ oboe_context_set(md);
97
+ }
98
+
99
+ static void fromString(std::string s) {
100
+ oboe_context_set_fromstr(s.data(), s.size());
101
+ }
102
+
103
+ // this new object is managed by SWIG %newobject
104
+ static Metadata *copy() {
105
+ return new Metadata(Context::get());
106
+ }
107
+
108
+ static void clear() {
109
+ oboe_context_clear();
110
+ }
111
+
112
+ static bool isValid() {
113
+ return oboe_context_is_valid();
114
+ }
115
+
116
+ static void init() {
117
+ oboe_init();
118
+ }
119
+
120
+ // these new objects are managed by SWIG %newobject
121
+ static Event *createEvent();
122
+ static Event *startTrace();
123
+ };
124
+
125
+ class Event : private oboe_event_t {
126
+ friend class UdpReporter;
127
+ friend class FileReporter;
128
+ friend class Context;
129
+ friend class Metadata;
130
+
131
+ private:
132
+ Event() {
133
+ oboe_event_init(this, Context::get());
134
+ }
135
+
136
+ Event(const oboe_metadata_t *md, bool addEdge=true) {
137
+ // both methods copy metadata from md -> this
138
+ if (addEdge) {
139
+ // create_event automatically adds edge in event to md
140
+ oboe_metadata_create_event(md, this);
141
+ } else {
142
+ // initializes new Event with this md's task_id & new random op_id; no edges set
143
+ oboe_event_init(this, md);
144
+ }
145
+ }
146
+
147
+ public:
148
+ ~Event() {
149
+ oboe_event_destroy(this);
150
+ }
151
+
152
+ // called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
153
+ bool addInfo(char *key, void* val) {
154
+ // oboe_event_add_info(evt, key, NULL) does nothing
155
+ return true;
156
+ }
157
+
158
+ bool addInfo(char *key, const std::string& val) {
159
+ if (memchr(val.data(), '\0', val.size())) {
160
+ return oboe_event_add_info_binary(this, key, val.data(), val.size()) == 0;
161
+ } else {
162
+ return oboe_event_add_info(this, key, val.data()) == 0;
163
+ }
164
+ }
165
+
166
+ bool addInfo(char *key, long val) {
167
+ int64_t val_ = val;
168
+ return oboe_event_add_info_int64(this, key, val_) == 0;
169
+ }
170
+
171
+ bool addInfo(char *key, double val) {
172
+ return oboe_event_add_info_double(this, key, val) == 0;
173
+ }
174
+
175
+ bool addEdge(oboe_metadata_t *md) {
176
+ return oboe_event_add_edge(this, md) == 0;
177
+ }
178
+
179
+ Metadata* getMetadata() {
180
+ return new Metadata(&this->metadata);
181
+ }
182
+
183
+ std::string metadataString() {
184
+ char buf[MAX_METADATA_PACK_LEN];
185
+
186
+ int rc = oboe_metadata_tostr(&this->metadata, buf, sizeof(buf) - 1);
187
+ if (rc == 0) {
188
+ return std::string(buf);
189
+ } else {
190
+ return std::string(); // throw exception?
191
+ }
192
+ }
193
+
194
+ static Event* startTrace(const oboe_metadata_t *md);
195
+
196
+ };
197
+
198
+ Event *Context::createEvent() {
199
+ return new Event(Context::get());
200
+ }
201
+
202
+ Event *Metadata::createEvent() {
203
+ return new Event(this);
204
+ }
205
+
206
+ Event *Context::startTrace() {
207
+ oboe_metadata_t *md = Context::get();
208
+ oboe_metadata_random(md);
209
+ return new Event();
210
+ }
211
+
212
+ Event *Event::startTrace(const oboe_metadata_t *md) {
213
+ return new Event(md, false);
214
+ }
215
+
216
+ class UdpReporter : private oboe_reporter_t {
217
+ public:
218
+ UdpReporter(const char *addr, const char *port=NULL) {
219
+ if (port == NULL)
220
+ port = "7831";
221
+
222
+ oboe_reporter_udp_init(this, addr, port);
223
+ }
224
+
225
+ ~UdpReporter() {
226
+ oboe_reporter_destroy(this);
227
+ }
228
+
229
+ bool sendReport(Event *evt) {
230
+ return oboe_reporter_send(this, Context::get(), evt) >= 0;
231
+ }
232
+
233
+ bool sendReport(Event *evt, oboe_metadata_t *md) {
234
+ return oboe_reporter_send(this, md, evt) >= 0;
235
+ }
236
+ };
237
+
238
+ class FileReporter : private oboe_reporter_t {
239
+ public:
240
+ FileReporter(const char *file) {
241
+ oboe_reporter_file_init(this, file);
242
+ }
243
+
244
+ ~FileReporter() {
245
+ oboe_reporter_destroy(this);
246
+ }
247
+
248
+ bool sendReport(Event *evt) {
249
+ return oboe_reporter_send(this, Context::get(), evt) >= 0;
250
+ }
251
+
252
+ bool sendReport(Event *evt, oboe_metadata_t *md) {
253
+ return oboe_reporter_send(this, md, evt) >= 0;
254
+ }
255
+ };
256
+ #endif
@@ -0,0 +1,3599 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 2.0.8
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #define SWIGRUBY
12
+
13
+
14
+ #ifdef __cplusplus
15
+ /* SwigValueWrapper is described in swig.swg */
16
+ template<typename T> class SwigValueWrapper {
17
+ struct SwigMovePointer {
18
+ T *ptr;
19
+ SwigMovePointer(T *p) : ptr(p) { }
20
+ ~SwigMovePointer() { delete ptr; }
21
+ SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
22
+ } pointer;
23
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
24
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs);
25
+ public:
26
+ SwigValueWrapper() : pointer(0) { }
27
+ SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
28
+ operator T&() const { return *pointer.ptr; }
29
+ T *operator&() { return pointer.ptr; }
30
+ };
31
+
32
+ template <typename T> T SwigValueInit() {
33
+ return T();
34
+ }
35
+ #endif
36
+
37
+ /* -----------------------------------------------------------------------------
38
+ * This section contains generic SWIG labels for method/variable
39
+ * declarations/attributes, and other compiler dependent labels.
40
+ * ----------------------------------------------------------------------------- */
41
+
42
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
43
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
44
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
45
+ # define SWIGTEMPLATEDISAMBIGUATOR template
46
+ # elif defined(__HP_aCC)
47
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
48
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
49
+ # define SWIGTEMPLATEDISAMBIGUATOR template
50
+ # else
51
+ # define SWIGTEMPLATEDISAMBIGUATOR
52
+ # endif
53
+ #endif
54
+
55
+ /* inline attribute */
56
+ #ifndef SWIGINLINE
57
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
58
+ # define SWIGINLINE inline
59
+ # else
60
+ # define SWIGINLINE
61
+ # endif
62
+ #endif
63
+
64
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
65
+ #ifndef SWIGUNUSED
66
+ # if defined(__GNUC__)
67
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
68
+ # define SWIGUNUSED __attribute__ ((__unused__))
69
+ # else
70
+ # define SWIGUNUSED
71
+ # endif
72
+ # elif defined(__ICC)
73
+ # define SWIGUNUSED __attribute__ ((__unused__))
74
+ # else
75
+ # define SWIGUNUSED
76
+ # endif
77
+ #endif
78
+
79
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
80
+ # if defined(_MSC_VER)
81
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
82
+ # endif
83
+ #endif
84
+
85
+ #ifndef SWIGUNUSEDPARM
86
+ # ifdef __cplusplus
87
+ # define SWIGUNUSEDPARM(p)
88
+ # else
89
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
90
+ # endif
91
+ #endif
92
+
93
+ /* internal SWIG method */
94
+ #ifndef SWIGINTERN
95
+ # define SWIGINTERN static SWIGUNUSED
96
+ #endif
97
+
98
+ /* internal inline SWIG method */
99
+ #ifndef SWIGINTERNINLINE
100
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
101
+ #endif
102
+
103
+ /* exporting methods */
104
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105
+ # ifndef GCC_HASCLASSVISIBILITY
106
+ # define GCC_HASCLASSVISIBILITY
107
+ # endif
108
+ #endif
109
+
110
+ #ifndef SWIGEXPORT
111
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112
+ # if defined(STATIC_LINKED)
113
+ # define SWIGEXPORT
114
+ # else
115
+ # define SWIGEXPORT __declspec(dllexport)
116
+ # endif
117
+ # else
118
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
119
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
120
+ # else
121
+ # define SWIGEXPORT
122
+ # endif
123
+ # endif
124
+ #endif
125
+
126
+ /* calling conventions for Windows */
127
+ #ifndef SWIGSTDCALL
128
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
129
+ # define SWIGSTDCALL __stdcall
130
+ # else
131
+ # define SWIGSTDCALL
132
+ # endif
133
+ #endif
134
+
135
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
136
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
137
+ # define _CRT_SECURE_NO_DEPRECATE
138
+ #endif
139
+
140
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
141
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
142
+ # define _SCL_SECURE_NO_DEPRECATE
143
+ #endif
144
+
145
+
146
+ /* -----------------------------------------------------------------------------
147
+ * This section contains generic SWIG labels for method/variable
148
+ * declarations/attributes, and other compiler dependent labels.
149
+ * ----------------------------------------------------------------------------- */
150
+
151
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
152
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
153
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
154
+ # define SWIGTEMPLATEDISAMBIGUATOR template
155
+ # elif defined(__HP_aCC)
156
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
157
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
158
+ # define SWIGTEMPLATEDISAMBIGUATOR template
159
+ # else
160
+ # define SWIGTEMPLATEDISAMBIGUATOR
161
+ # endif
162
+ #endif
163
+
164
+ /* inline attribute */
165
+ #ifndef SWIGINLINE
166
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
167
+ # define SWIGINLINE inline
168
+ # else
169
+ # define SWIGINLINE
170
+ # endif
171
+ #endif
172
+
173
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
174
+ #ifndef SWIGUNUSED
175
+ # if defined(__GNUC__)
176
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
177
+ # define SWIGUNUSED __attribute__ ((__unused__))
178
+ # else
179
+ # define SWIGUNUSED
180
+ # endif
181
+ # elif defined(__ICC)
182
+ # define SWIGUNUSED __attribute__ ((__unused__))
183
+ # else
184
+ # define SWIGUNUSED
185
+ # endif
186
+ #endif
187
+
188
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
189
+ # if defined(_MSC_VER)
190
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
191
+ # endif
192
+ #endif
193
+
194
+ #ifndef SWIGUNUSEDPARM
195
+ # ifdef __cplusplus
196
+ # define SWIGUNUSEDPARM(p)
197
+ # else
198
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
199
+ # endif
200
+ #endif
201
+
202
+ /* internal SWIG method */
203
+ #ifndef SWIGINTERN
204
+ # define SWIGINTERN static SWIGUNUSED
205
+ #endif
206
+
207
+ /* internal inline SWIG method */
208
+ #ifndef SWIGINTERNINLINE
209
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
210
+ #endif
211
+
212
+ /* exporting methods */
213
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
214
+ # ifndef GCC_HASCLASSVISIBILITY
215
+ # define GCC_HASCLASSVISIBILITY
216
+ # endif
217
+ #endif
218
+
219
+ #ifndef SWIGEXPORT
220
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
221
+ # if defined(STATIC_LINKED)
222
+ # define SWIGEXPORT
223
+ # else
224
+ # define SWIGEXPORT __declspec(dllexport)
225
+ # endif
226
+ # else
227
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
228
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
229
+ # else
230
+ # define SWIGEXPORT
231
+ # endif
232
+ # endif
233
+ #endif
234
+
235
+ /* calling conventions for Windows */
236
+ #ifndef SWIGSTDCALL
237
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
238
+ # define SWIGSTDCALL __stdcall
239
+ # else
240
+ # define SWIGSTDCALL
241
+ # endif
242
+ #endif
243
+
244
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
245
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
246
+ # define _CRT_SECURE_NO_DEPRECATE
247
+ #endif
248
+
249
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
250
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
251
+ # define _SCL_SECURE_NO_DEPRECATE
252
+ #endif
253
+
254
+
255
+ /* -----------------------------------------------------------------------------
256
+ * swigrun.swg
257
+ *
258
+ * This file contains generic C API SWIG runtime support for pointer
259
+ * type checking.
260
+ * ----------------------------------------------------------------------------- */
261
+
262
+ /* This should only be incremented when either the layout of swig_type_info changes,
263
+ or for whatever reason, the runtime changes incompatibly */
264
+ #define SWIG_RUNTIME_VERSION "4"
265
+
266
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
267
+ #ifdef SWIG_TYPE_TABLE
268
+ # define SWIG_QUOTE_STRING(x) #x
269
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
270
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
271
+ #else
272
+ # define SWIG_TYPE_TABLE_NAME
273
+ #endif
274
+
275
+ /*
276
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
277
+ creating a static or dynamic library from the SWIG runtime code.
278
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
279
+
280
+ But only do this if strictly necessary, ie, if you have problems
281
+ with your compiler or suchlike.
282
+ */
283
+
284
+ #ifndef SWIGRUNTIME
285
+ # define SWIGRUNTIME SWIGINTERN
286
+ #endif
287
+
288
+ #ifndef SWIGRUNTIMEINLINE
289
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
290
+ #endif
291
+
292
+ /* Generic buffer size */
293
+ #ifndef SWIG_BUFFER_SIZE
294
+ # define SWIG_BUFFER_SIZE 1024
295
+ #endif
296
+
297
+ /* Flags for pointer conversions */
298
+ #define SWIG_POINTER_DISOWN 0x1
299
+ #define SWIG_CAST_NEW_MEMORY 0x2
300
+
301
+ /* Flags for new pointer objects */
302
+ #define SWIG_POINTER_OWN 0x1
303
+
304
+
305
+ /*
306
+ Flags/methods for returning states.
307
+
308
+ The SWIG conversion methods, as ConvertPtr, return an integer
309
+ that tells if the conversion was successful or not. And if not,
310
+ an error code can be returned (see swigerrors.swg for the codes).
311
+
312
+ Use the following macros/flags to set or process the returning
313
+ states.
314
+
315
+ In old versions of SWIG, code such as the following was usually written:
316
+
317
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
318
+ // success code
319
+ } else {
320
+ //fail code
321
+ }
322
+
323
+ Now you can be more explicit:
324
+
325
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
326
+ if (SWIG_IsOK(res)) {
327
+ // success code
328
+ } else {
329
+ // fail code
330
+ }
331
+
332
+ which is the same really, but now you can also do
333
+
334
+ Type *ptr;
335
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
336
+ if (SWIG_IsOK(res)) {
337
+ // success code
338
+ if (SWIG_IsNewObj(res) {
339
+ ...
340
+ delete *ptr;
341
+ } else {
342
+ ...
343
+ }
344
+ } else {
345
+ // fail code
346
+ }
347
+
348
+ I.e., now SWIG_ConvertPtr can return new objects and you can
349
+ identify the case and take care of the deallocation. Of course that
350
+ also requires SWIG_ConvertPtr to return new result values, such as
351
+
352
+ int SWIG_ConvertPtr(obj, ptr,...) {
353
+ if (<obj is ok>) {
354
+ if (<need new object>) {
355
+ *ptr = <ptr to new allocated object>;
356
+ return SWIG_NEWOBJ;
357
+ } else {
358
+ *ptr = <ptr to old object>;
359
+ return SWIG_OLDOBJ;
360
+ }
361
+ } else {
362
+ return SWIG_BADOBJ;
363
+ }
364
+ }
365
+
366
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
367
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
368
+ SWIG errors code.
369
+
370
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
371
+ allows to return the 'cast rank', for example, if you have this
372
+
373
+ int food(double)
374
+ int fooi(int);
375
+
376
+ and you call
377
+
378
+ food(1) // cast rank '1' (1 -> 1.0)
379
+ fooi(1) // cast rank '0'
380
+
381
+ just use the SWIG_AddCast()/SWIG_CheckState()
382
+ */
383
+
384
+ #define SWIG_OK (0)
385
+ #define SWIG_ERROR (-1)
386
+ #define SWIG_IsOK(r) (r >= 0)
387
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
388
+
389
+ /* The CastRankLimit says how many bits are used for the cast rank */
390
+ #define SWIG_CASTRANKLIMIT (1 << 8)
391
+ /* The NewMask denotes the object was created (using new/malloc) */
392
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
393
+ /* The TmpMask is for in/out typemaps that use temporal objects */
394
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
395
+ /* Simple returning values */
396
+ #define SWIG_BADOBJ (SWIG_ERROR)
397
+ #define SWIG_OLDOBJ (SWIG_OK)
398
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
399
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
400
+ /* Check, add and del mask methods */
401
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
402
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
403
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
404
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
405
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
406
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
407
+
408
+ /* Cast-Rank Mode */
409
+ #if defined(SWIG_CASTRANK_MODE)
410
+ # ifndef SWIG_TypeRank
411
+ # define SWIG_TypeRank unsigned long
412
+ # endif
413
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
414
+ # define SWIG_MAXCASTRANK (2)
415
+ # endif
416
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
417
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
418
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
419
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
420
+ }
421
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
422
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
423
+ }
424
+ #else /* no cast-rank mode */
425
+ # define SWIG_AddCast
426
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
427
+ #endif
428
+
429
+
430
+ #include <string.h>
431
+
432
+ #ifdef __cplusplus
433
+ extern "C" {
434
+ #endif
435
+
436
+ typedef void *(*swig_converter_func)(void *, int *);
437
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
438
+
439
+ /* Structure to store information on one type */
440
+ typedef struct swig_type_info {
441
+ const char *name; /* mangled name of this type */
442
+ const char *str; /* human readable name of this type */
443
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
444
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
445
+ void *clientdata; /* language specific type data */
446
+ int owndata; /* flag if the structure owns the clientdata */
447
+ } swig_type_info;
448
+
449
+ /* Structure to store a type and conversion function used for casting */
450
+ typedef struct swig_cast_info {
451
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
452
+ swig_converter_func converter; /* function to cast the void pointers */
453
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
454
+ struct swig_cast_info *prev; /* pointer to the previous cast */
455
+ } swig_cast_info;
456
+
457
+ /* Structure used to store module information
458
+ * Each module generates one structure like this, and the runtime collects
459
+ * all of these structures and stores them in a circularly linked list.*/
460
+ typedef struct swig_module_info {
461
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
462
+ size_t size; /* Number of types in this module */
463
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
464
+ swig_type_info **type_initial; /* Array of initially generated type structures */
465
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
466
+ void *clientdata; /* Language specific module data */
467
+ } swig_module_info;
468
+
469
+ /*
470
+ Compare two type names skipping the space characters, therefore
471
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
472
+
473
+ Return 0 when the two name types are equivalent, as in
474
+ strncmp, but skipping ' '.
475
+ */
476
+ SWIGRUNTIME int
477
+ SWIG_TypeNameComp(const char *f1, const char *l1,
478
+ const char *f2, const char *l2) {
479
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
480
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
481
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
482
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
483
+ }
484
+ return (int)((l1 - f1) - (l2 - f2));
485
+ }
486
+
487
+ /*
488
+ Check type equivalence in a name list like <name1>|<name2>|...
489
+ Return 0 if not equal, 1 if equal
490
+ */
491
+ SWIGRUNTIME int
492
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
493
+ int equiv = 0;
494
+ const char* te = tb + strlen(tb);
495
+ const char* ne = nb;
496
+ while (!equiv && *ne) {
497
+ for (nb = ne; *ne; ++ne) {
498
+ if (*ne == '|') break;
499
+ }
500
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
501
+ if (*ne) ++ne;
502
+ }
503
+ return equiv;
504
+ }
505
+
506
+ /*
507
+ Check type equivalence in a name list like <name1>|<name2>|...
508
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
509
+ */
510
+ SWIGRUNTIME int
511
+ SWIG_TypeCompare(const char *nb, const char *tb) {
512
+ int equiv = 0;
513
+ const char* te = tb + strlen(tb);
514
+ const char* ne = nb;
515
+ while (!equiv && *ne) {
516
+ for (nb = ne; *ne; ++ne) {
517
+ if (*ne == '|') break;
518
+ }
519
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
520
+ if (*ne) ++ne;
521
+ }
522
+ return equiv;
523
+ }
524
+
525
+
526
+ /*
527
+ Check the typename
528
+ */
529
+ SWIGRUNTIME swig_cast_info *
530
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
531
+ if (ty) {
532
+ swig_cast_info *iter = ty->cast;
533
+ while (iter) {
534
+ if (strcmp(iter->type->name, c) == 0) {
535
+ if (iter == ty->cast)
536
+ return iter;
537
+ /* Move iter to the top of the linked list */
538
+ iter->prev->next = iter->next;
539
+ if (iter->next)
540
+ iter->next->prev = iter->prev;
541
+ iter->next = ty->cast;
542
+ iter->prev = 0;
543
+ if (ty->cast) ty->cast->prev = iter;
544
+ ty->cast = iter;
545
+ return iter;
546
+ }
547
+ iter = iter->next;
548
+ }
549
+ }
550
+ return 0;
551
+ }
552
+
553
+ /*
554
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
555
+ */
556
+ SWIGRUNTIME swig_cast_info *
557
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
558
+ if (ty) {
559
+ swig_cast_info *iter = ty->cast;
560
+ while (iter) {
561
+ if (iter->type == from) {
562
+ if (iter == ty->cast)
563
+ return iter;
564
+ /* Move iter to the top of the linked list */
565
+ iter->prev->next = iter->next;
566
+ if (iter->next)
567
+ iter->next->prev = iter->prev;
568
+ iter->next = ty->cast;
569
+ iter->prev = 0;
570
+ if (ty->cast) ty->cast->prev = iter;
571
+ ty->cast = iter;
572
+ return iter;
573
+ }
574
+ iter = iter->next;
575
+ }
576
+ }
577
+ return 0;
578
+ }
579
+
580
+ /*
581
+ Cast a pointer up an inheritance hierarchy
582
+ */
583
+ SWIGRUNTIMEINLINE void *
584
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
585
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
586
+ }
587
+
588
+ /*
589
+ Dynamic pointer casting. Down an inheritance hierarchy
590
+ */
591
+ SWIGRUNTIME swig_type_info *
592
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
593
+ swig_type_info *lastty = ty;
594
+ if (!ty || !ty->dcast) return ty;
595
+ while (ty && (ty->dcast)) {
596
+ ty = (*ty->dcast)(ptr);
597
+ if (ty) lastty = ty;
598
+ }
599
+ return lastty;
600
+ }
601
+
602
+ /*
603
+ Return the name associated with this type
604
+ */
605
+ SWIGRUNTIMEINLINE const char *
606
+ SWIG_TypeName(const swig_type_info *ty) {
607
+ return ty->name;
608
+ }
609
+
610
+ /*
611
+ Return the pretty name associated with this type,
612
+ that is an unmangled type name in a form presentable to the user.
613
+ */
614
+ SWIGRUNTIME const char *
615
+ SWIG_TypePrettyName(const swig_type_info *type) {
616
+ /* The "str" field contains the equivalent pretty names of the
617
+ type, separated by vertical-bar characters. We choose
618
+ to print the last name, as it is often (?) the most
619
+ specific. */
620
+ if (!type) return NULL;
621
+ if (type->str != NULL) {
622
+ const char *last_name = type->str;
623
+ const char *s;
624
+ for (s = type->str; *s; s++)
625
+ if (*s == '|') last_name = s+1;
626
+ return last_name;
627
+ }
628
+ else
629
+ return type->name;
630
+ }
631
+
632
+ /*
633
+ Set the clientdata field for a type
634
+ */
635
+ SWIGRUNTIME void
636
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
637
+ swig_cast_info *cast = ti->cast;
638
+ /* if (ti->clientdata == clientdata) return; */
639
+ ti->clientdata = clientdata;
640
+
641
+ while (cast) {
642
+ if (!cast->converter) {
643
+ swig_type_info *tc = cast->type;
644
+ if (!tc->clientdata) {
645
+ SWIG_TypeClientData(tc, clientdata);
646
+ }
647
+ }
648
+ cast = cast->next;
649
+ }
650
+ }
651
+ SWIGRUNTIME void
652
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
653
+ SWIG_TypeClientData(ti, clientdata);
654
+ ti->owndata = 1;
655
+ }
656
+
657
+ /*
658
+ Search for a swig_type_info structure only by mangled name
659
+ Search is a O(log #types)
660
+
661
+ We start searching at module start, and finish searching when start == end.
662
+ Note: if start == end at the beginning of the function, we go all the way around
663
+ the circular list.
664
+ */
665
+ SWIGRUNTIME swig_type_info *
666
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
667
+ swig_module_info *end,
668
+ const char *name) {
669
+ swig_module_info *iter = start;
670
+ do {
671
+ if (iter->size) {
672
+ register size_t l = 0;
673
+ register size_t r = iter->size - 1;
674
+ do {
675
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
676
+ register size_t i = (l + r) >> 1;
677
+ const char *iname = iter->types[i]->name;
678
+ if (iname) {
679
+ register int compare = strcmp(name, iname);
680
+ if (compare == 0) {
681
+ return iter->types[i];
682
+ } else if (compare < 0) {
683
+ if (i) {
684
+ r = i - 1;
685
+ } else {
686
+ break;
687
+ }
688
+ } else if (compare > 0) {
689
+ l = i + 1;
690
+ }
691
+ } else {
692
+ break; /* should never happen */
693
+ }
694
+ } while (l <= r);
695
+ }
696
+ iter = iter->next;
697
+ } while (iter != end);
698
+ return 0;
699
+ }
700
+
701
+ /*
702
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
703
+ It first searches the mangled names of the types, which is a O(log #types)
704
+ If a type is not found it then searches the human readable names, which is O(#types).
705
+
706
+ We start searching at module start, and finish searching when start == end.
707
+ Note: if start == end at the beginning of the function, we go all the way around
708
+ the circular list.
709
+ */
710
+ SWIGRUNTIME swig_type_info *
711
+ SWIG_TypeQueryModule(swig_module_info *start,
712
+ swig_module_info *end,
713
+ const char *name) {
714
+ /* STEP 1: Search the name field using binary search */
715
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
716
+ if (ret) {
717
+ return ret;
718
+ } else {
719
+ /* STEP 2: If the type hasn't been found, do a complete search
720
+ of the str field (the human readable name) */
721
+ swig_module_info *iter = start;
722
+ do {
723
+ register size_t i = 0;
724
+ for (; i < iter->size; ++i) {
725
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
726
+ return iter->types[i];
727
+ }
728
+ iter = iter->next;
729
+ } while (iter != end);
730
+ }
731
+
732
+ /* neither found a match */
733
+ return 0;
734
+ }
735
+
736
+ /*
737
+ Pack binary data into a string
738
+ */
739
+ SWIGRUNTIME char *
740
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
741
+ static const char hex[17] = "0123456789abcdef";
742
+ register const unsigned char *u = (unsigned char *) ptr;
743
+ register const unsigned char *eu = u + sz;
744
+ for (; u != eu; ++u) {
745
+ register unsigned char uu = *u;
746
+ *(c++) = hex[(uu & 0xf0) >> 4];
747
+ *(c++) = hex[uu & 0xf];
748
+ }
749
+ return c;
750
+ }
751
+
752
+ /*
753
+ Unpack binary data from a string
754
+ */
755
+ SWIGRUNTIME const char *
756
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
757
+ register unsigned char *u = (unsigned char *) ptr;
758
+ register const unsigned char *eu = u + sz;
759
+ for (; u != eu; ++u) {
760
+ register char d = *(c++);
761
+ register unsigned char uu;
762
+ if ((d >= '0') && (d <= '9'))
763
+ uu = ((d - '0') << 4);
764
+ else if ((d >= 'a') && (d <= 'f'))
765
+ uu = ((d - ('a'-10)) << 4);
766
+ else
767
+ return (char *) 0;
768
+ d = *(c++);
769
+ if ((d >= '0') && (d <= '9'))
770
+ uu |= (d - '0');
771
+ else if ((d >= 'a') && (d <= 'f'))
772
+ uu |= (d - ('a'-10));
773
+ else
774
+ return (char *) 0;
775
+ *u = uu;
776
+ }
777
+ return c;
778
+ }
779
+
780
+ /*
781
+ Pack 'void *' into a string buffer.
782
+ */
783
+ SWIGRUNTIME char *
784
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
785
+ char *r = buff;
786
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
787
+ *(r++) = '_';
788
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
789
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
790
+ strcpy(r,name);
791
+ return buff;
792
+ }
793
+
794
+ SWIGRUNTIME const char *
795
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
796
+ if (*c != '_') {
797
+ if (strcmp(c,"NULL") == 0) {
798
+ *ptr = (void *) 0;
799
+ return name;
800
+ } else {
801
+ return 0;
802
+ }
803
+ }
804
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
805
+ }
806
+
807
+ SWIGRUNTIME char *
808
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
809
+ char *r = buff;
810
+ size_t lname = (name ? strlen(name) : 0);
811
+ if ((2*sz + 2 + lname) > bsz) return 0;
812
+ *(r++) = '_';
813
+ r = SWIG_PackData(r,ptr,sz);
814
+ if (lname) {
815
+ strncpy(r,name,lname+1);
816
+ } else {
817
+ *r = 0;
818
+ }
819
+ return buff;
820
+ }
821
+
822
+ SWIGRUNTIME const char *
823
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
824
+ if (*c != '_') {
825
+ if (strcmp(c,"NULL") == 0) {
826
+ memset(ptr,0,sz);
827
+ return name;
828
+ } else {
829
+ return 0;
830
+ }
831
+ }
832
+ return SWIG_UnpackData(++c,ptr,sz);
833
+ }
834
+
835
+ #ifdef __cplusplus
836
+ }
837
+ #endif
838
+
839
+ /* Errors in SWIG */
840
+ #define SWIG_UnknownError -1
841
+ #define SWIG_IOError -2
842
+ #define SWIG_RuntimeError -3
843
+ #define SWIG_IndexError -4
844
+ #define SWIG_TypeError -5
845
+ #define SWIG_DivisionByZero -6
846
+ #define SWIG_OverflowError -7
847
+ #define SWIG_SyntaxError -8
848
+ #define SWIG_ValueError -9
849
+ #define SWIG_SystemError -10
850
+ #define SWIG_AttributeError -11
851
+ #define SWIG_MemoryError -12
852
+ #define SWIG_NullReferenceError -13
853
+
854
+
855
+
856
+ #include <ruby.h>
857
+
858
+ /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
859
+ * breaks using rb_intern as an lvalue, as SWIG does. We work around this
860
+ * issue for now by disabling this.
861
+ * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
862
+ */
863
+ #ifdef rb_intern
864
+ # undef rb_intern
865
+ #endif
866
+
867
+ /* Remove global macros defined in Ruby's win32.h */
868
+ #ifdef write
869
+ # undef write
870
+ #endif
871
+ #ifdef read
872
+ # undef read
873
+ #endif
874
+ #ifdef bind
875
+ # undef bind
876
+ #endif
877
+ #ifdef close
878
+ # undef close
879
+ #endif
880
+ #ifdef connect
881
+ # undef connect
882
+ #endif
883
+
884
+
885
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
886
+ #ifndef NUM2LL
887
+ #define NUM2LL(x) NUM2LONG((x))
888
+ #endif
889
+ #ifndef LL2NUM
890
+ #define LL2NUM(x) INT2NUM((long) (x))
891
+ #endif
892
+ #ifndef ULL2NUM
893
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
894
+ #endif
895
+
896
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
897
+ #ifndef NUM2ULL
898
+ #ifdef HAVE_LONG_LONG
899
+ #define NUM2ULL(x) rb_num2ull((x))
900
+ #else
901
+ #define NUM2ULL(x) NUM2ULONG(x)
902
+ #endif
903
+ #endif
904
+
905
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
906
+ /* Define these for older versions so we can just write code the new way */
907
+ #ifndef RSTRING_LEN
908
+ # define RSTRING_LEN(x) RSTRING(x)->len
909
+ #endif
910
+ #ifndef RSTRING_PTR
911
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
912
+ #endif
913
+ #ifndef RSTRING_END
914
+ # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
915
+ #endif
916
+ #ifndef RARRAY_LEN
917
+ # define RARRAY_LEN(x) RARRAY(x)->len
918
+ #endif
919
+ #ifndef RARRAY_PTR
920
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
921
+ #endif
922
+ #ifndef RFLOAT_VALUE
923
+ # define RFLOAT_VALUE(x) RFLOAT(x)->value
924
+ #endif
925
+ #ifndef DOUBLE2NUM
926
+ # define DOUBLE2NUM(x) rb_float_new(x)
927
+ #endif
928
+ #ifndef RHASH_TBL
929
+ # define RHASH_TBL(x) (RHASH(x)->tbl)
930
+ #endif
931
+ #ifndef RHASH_ITER_LEV
932
+ # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
933
+ #endif
934
+ #ifndef RHASH_IFNONE
935
+ # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
936
+ #endif
937
+ #ifndef RHASH_SIZE
938
+ # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
939
+ #endif
940
+ #ifndef RHASH_EMPTY_P
941
+ # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
942
+ #endif
943
+ #ifndef RSTRUCT_LEN
944
+ # define RSTRUCT_LEN(x) RSTRUCT(x)->len
945
+ #endif
946
+ #ifndef RSTRUCT_PTR
947
+ # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
948
+ #endif
949
+
950
+
951
+
952
+ /*
953
+ * Need to be very careful about how these macros are defined, especially
954
+ * when compiling C++ code or C code with an ANSI C compiler.
955
+ *
956
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
957
+ * a Ruby method so that it can be passed as an argument to API functions
958
+ * like rb_define_method() and rb_define_singleton_method().
959
+ *
960
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
961
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
962
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
963
+ * and Data_Make_Struct().
964
+ */
965
+
966
+ #ifdef __cplusplus
967
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
968
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
969
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
970
+ # define VOIDFUNC(f) ((void (*)()) f)
971
+ # else
972
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
973
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
974
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
975
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
976
+ # else /* These definitions should work for Ruby 1.7+ */
977
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
978
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
979
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
980
+ # endif
981
+ # endif
982
+ #else
983
+ # define VALUEFUNC(f) (f)
984
+ # define VOIDFUNC(f) (f)
985
+ #endif
986
+
987
+ /* Don't use for expressions have side effect */
988
+ #ifndef RB_STRING_VALUE
989
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
990
+ #endif
991
+ #ifndef StringValue
992
+ #define StringValue(s) RB_STRING_VALUE(s)
993
+ #endif
994
+ #ifndef StringValuePtr
995
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
996
+ #endif
997
+ #ifndef StringValueLen
998
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
999
+ #endif
1000
+ #ifndef SafeStringValue
1001
+ #define SafeStringValue(v) do {\
1002
+ StringValue(v);\
1003
+ rb_check_safe_str(v);\
1004
+ } while (0)
1005
+ #endif
1006
+
1007
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1008
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1009
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1010
+ #endif
1011
+
1012
+ static VALUE _mSWIG = Qnil;
1013
+
1014
+ /* -----------------------------------------------------------------------------
1015
+ * error manipulation
1016
+ * ----------------------------------------------------------------------------- */
1017
+
1018
+
1019
+ /* Define some additional error types */
1020
+ #define SWIG_ObjectPreviouslyDeletedError -100
1021
+
1022
+
1023
+ /* Define custom exceptions for errors that do not map to existing Ruby
1024
+ exceptions. Note this only works for C++ since a global cannot be
1025
+ initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1026
+
1027
+ SWIGINTERN VALUE
1028
+ getNullReferenceError(void) {
1029
+ static int init = 0;
1030
+ static VALUE rb_eNullReferenceError ;
1031
+ if (!init) {
1032
+ init = 1;
1033
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1034
+ }
1035
+ return rb_eNullReferenceError;
1036
+ }
1037
+
1038
+ SWIGINTERN VALUE
1039
+ getObjectPreviouslyDeletedError(void) {
1040
+ static int init = 0;
1041
+ static VALUE rb_eObjectPreviouslyDeleted ;
1042
+ if (!init) {
1043
+ init = 1;
1044
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1045
+ }
1046
+ return rb_eObjectPreviouslyDeleted;
1047
+ }
1048
+
1049
+
1050
+ SWIGINTERN VALUE
1051
+ SWIG_Ruby_ErrorType(int SWIG_code) {
1052
+ VALUE type;
1053
+ switch (SWIG_code) {
1054
+ case SWIG_MemoryError:
1055
+ type = rb_eNoMemError;
1056
+ break;
1057
+ case SWIG_IOError:
1058
+ type = rb_eIOError;
1059
+ break;
1060
+ case SWIG_RuntimeError:
1061
+ type = rb_eRuntimeError;
1062
+ break;
1063
+ case SWIG_IndexError:
1064
+ type = rb_eIndexError;
1065
+ break;
1066
+ case SWIG_TypeError:
1067
+ type = rb_eTypeError;
1068
+ break;
1069
+ case SWIG_DivisionByZero:
1070
+ type = rb_eZeroDivError;
1071
+ break;
1072
+ case SWIG_OverflowError:
1073
+ type = rb_eRangeError;
1074
+ break;
1075
+ case SWIG_SyntaxError:
1076
+ type = rb_eSyntaxError;
1077
+ break;
1078
+ case SWIG_ValueError:
1079
+ type = rb_eArgError;
1080
+ break;
1081
+ case SWIG_SystemError:
1082
+ type = rb_eFatal;
1083
+ break;
1084
+ case SWIG_AttributeError:
1085
+ type = rb_eRuntimeError;
1086
+ break;
1087
+ case SWIG_NullReferenceError:
1088
+ type = getNullReferenceError();
1089
+ break;
1090
+ case SWIG_ObjectPreviouslyDeletedError:
1091
+ type = getObjectPreviouslyDeletedError();
1092
+ break;
1093
+ case SWIG_UnknownError:
1094
+ type = rb_eRuntimeError;
1095
+ break;
1096
+ default:
1097
+ type = rb_eRuntimeError;
1098
+ }
1099
+ return type;
1100
+ }
1101
+
1102
+
1103
+ /* This function is called when a user inputs a wrong argument to
1104
+ a method.
1105
+ */
1106
+ SWIGINTERN
1107
+ const char* Ruby_Format_TypeError( const char* msg,
1108
+ const char* type,
1109
+ const char* name,
1110
+ const int argn,
1111
+ VALUE input )
1112
+ {
1113
+ char buf[128];
1114
+ VALUE str;
1115
+ VALUE asStr;
1116
+ if ( msg && *msg )
1117
+ {
1118
+ str = rb_str_new2(msg);
1119
+ }
1120
+ else
1121
+ {
1122
+ str = rb_str_new(NULL, 0);
1123
+ }
1124
+
1125
+ str = rb_str_cat2( str, "Expected argument " );
1126
+ sprintf( buf, "%d of type ", argn-1 );
1127
+ str = rb_str_cat2( str, buf );
1128
+ str = rb_str_cat2( str, type );
1129
+ str = rb_str_cat2( str, ", but got " );
1130
+ str = rb_str_cat2( str, rb_obj_classname(input) );
1131
+ str = rb_str_cat2( str, " " );
1132
+ asStr = rb_inspect(input);
1133
+ if ( RSTRING_LEN(asStr) > 30 )
1134
+ {
1135
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1136
+ str = rb_str_cat2( str, "..." );
1137
+ }
1138
+ else
1139
+ {
1140
+ str = rb_str_append( str, asStr );
1141
+ }
1142
+
1143
+ if ( name )
1144
+ {
1145
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
1146
+ str = rb_str_cat2( str, name );
1147
+ str = rb_str_cat2( str, "'" );
1148
+ }
1149
+
1150
+ return StringValuePtr( str );
1151
+ }
1152
+
1153
+ /* This function is called when an overloaded method fails */
1154
+ SWIGINTERN
1155
+ void Ruby_Format_OverloadedError(
1156
+ const int argc,
1157
+ const int maxargs,
1158
+ const char* method,
1159
+ const char* prototypes
1160
+ )
1161
+ {
1162
+ const char* msg = "Wrong # of arguments";
1163
+ if ( argc <= maxargs ) msg = "Wrong arguments";
1164
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1165
+ "Possible C/C++ prototypes are:\n%s",
1166
+ msg, method, prototypes);
1167
+ }
1168
+
1169
+ /* -----------------------------------------------------------------------------
1170
+ * rubytracking.swg
1171
+ *
1172
+ * This file contains support for tracking mappings from
1173
+ * Ruby objects to C++ objects. This functionality is needed
1174
+ * to implement mark functions for Ruby's mark and sweep
1175
+ * garbage collector.
1176
+ * ----------------------------------------------------------------------------- */
1177
+
1178
+ #ifdef __cplusplus
1179
+ extern "C" {
1180
+ #endif
1181
+
1182
+ /* Ruby 1.8 actually assumes the first case. */
1183
+ #if SIZEOF_VOIDP == SIZEOF_LONG
1184
+ # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1185
+ # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1186
+ #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1187
+ # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1188
+ # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1189
+ #else
1190
+ # error sizeof(void*) is not the same as long or long long
1191
+ #endif
1192
+
1193
+
1194
+ /* Global Ruby hash table to store Trackings from C/C++
1195
+ structs to Ruby Objects.
1196
+ */
1197
+ static VALUE swig_ruby_trackings = Qnil;
1198
+
1199
+ /* Global variable that stores a reference to the ruby
1200
+ hash table delete function. */
1201
+ static ID swig_ruby_hash_delete;
1202
+
1203
+ /* Setup a Ruby hash table to store Trackings */
1204
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1205
+ /* Create a ruby hash table to store Trackings from C++
1206
+ objects to Ruby objects. */
1207
+
1208
+ /* Try to see if some other .so has already created a
1209
+ tracking hash table, which we keep hidden in an instance var
1210
+ in the SWIG module.
1211
+ This is done to allow multiple DSOs to share the same
1212
+ tracking table.
1213
+ */
1214
+ ID trackings_id = rb_intern( "@__trackings__" );
1215
+ VALUE verbose = rb_gv_get("VERBOSE");
1216
+ rb_gv_set("VERBOSE", Qfalse);
1217
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1218
+ rb_gv_set("VERBOSE", verbose);
1219
+
1220
+ /* No, it hasn't. Create one ourselves */
1221
+ if ( swig_ruby_trackings == Qnil )
1222
+ {
1223
+ swig_ruby_trackings = rb_hash_new();
1224
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1225
+ }
1226
+
1227
+ /* Now store a reference to the hash table delete function
1228
+ so that we only have to look it up once.*/
1229
+ swig_ruby_hash_delete = rb_intern("delete");
1230
+ }
1231
+
1232
+ /* Get a Ruby number to reference a pointer */
1233
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1234
+ /* We cast the pointer to an unsigned long
1235
+ and then store a reference to it using
1236
+ a Ruby number object. */
1237
+
1238
+ /* Convert the pointer to a Ruby number */
1239
+ return SWIG2NUM(ptr);
1240
+ }
1241
+
1242
+ /* Get a Ruby number to reference an object */
1243
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1244
+ /* We cast the object to an unsigned long
1245
+ and then store a reference to it using
1246
+ a Ruby number object. */
1247
+
1248
+ /* Convert the Object to a Ruby number */
1249
+ return SWIG2NUM(object);
1250
+ }
1251
+
1252
+ /* Get a Ruby object from a previously stored reference */
1253
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1254
+ /* The provided Ruby number object is a reference
1255
+ to the Ruby object we want.*/
1256
+
1257
+ /* Convert the Ruby number to a Ruby object */
1258
+ return NUM2SWIG(reference);
1259
+ }
1260
+
1261
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1262
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1263
+ /* In a Ruby hash table we store the pointer and
1264
+ the associated Ruby object. The trick here is
1265
+ that we cannot store the Ruby object directly - if
1266
+ we do then it cannot be garbage collected. So
1267
+ instead we typecast it as a unsigned long and
1268
+ convert it to a Ruby number object.*/
1269
+
1270
+ /* Get a reference to the pointer as a Ruby number */
1271
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1272
+
1273
+ /* Get a reference to the Ruby object as a Ruby number */
1274
+ VALUE value = SWIG_RubyObjectToReference(object);
1275
+
1276
+ /* Store the mapping to the global hash table. */
1277
+ rb_hash_aset(swig_ruby_trackings, key, value);
1278
+ }
1279
+
1280
+ /* Get the Ruby object that owns the specified C/C++ struct */
1281
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1282
+ /* Get a reference to the pointer as a Ruby number */
1283
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1284
+
1285
+ /* Now lookup the value stored in the global hash table */
1286
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1287
+
1288
+ if (value == Qnil) {
1289
+ /* No object exists - return nil. */
1290
+ return Qnil;
1291
+ }
1292
+ else {
1293
+ /* Convert this value to Ruby object */
1294
+ return SWIG_RubyReferenceToObject(value);
1295
+ }
1296
+ }
1297
+
1298
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1299
+ is very important to remove objects once they are destroyed
1300
+ since the same memory address may be reused later to create
1301
+ a new object. */
1302
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1303
+ /* Get a reference to the pointer as a Ruby number */
1304
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1305
+
1306
+ /* Delete the object from the hash table by calling Ruby's
1307
+ do this we need to call the Hash.delete method.*/
1308
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1309
+ }
1310
+
1311
+ /* This is a helper method that unlinks a Ruby object from its
1312
+ underlying C++ object. This is needed if the lifetime of the
1313
+ Ruby object is longer than the C++ object */
1314
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1315
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1316
+
1317
+ if (object != Qnil) {
1318
+ DATA_PTR(object) = 0;
1319
+ }
1320
+ }
1321
+
1322
+
1323
+ #ifdef __cplusplus
1324
+ }
1325
+ #endif
1326
+
1327
+ /* -----------------------------------------------------------------------------
1328
+ * Ruby API portion that goes into the runtime
1329
+ * ----------------------------------------------------------------------------- */
1330
+
1331
+ #ifdef __cplusplus
1332
+ extern "C" {
1333
+ #endif
1334
+
1335
+ SWIGINTERN VALUE
1336
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1337
+ if (NIL_P(target)) {
1338
+ target = o;
1339
+ } else {
1340
+ if (TYPE(target) != T_ARRAY) {
1341
+ VALUE o2 = target;
1342
+ target = rb_ary_new();
1343
+ rb_ary_push(target, o2);
1344
+ }
1345
+ rb_ary_push(target, o);
1346
+ }
1347
+ return target;
1348
+ }
1349
+
1350
+ /* For ruby1.8.4 and earlier. */
1351
+ #ifndef RUBY_INIT_STACK
1352
+ RUBY_EXTERN void Init_stack(VALUE* addr);
1353
+ # define RUBY_INIT_STACK \
1354
+ VALUE variable_in_this_stack_frame; \
1355
+ Init_stack(&variable_in_this_stack_frame);
1356
+ #endif
1357
+
1358
+
1359
+ #ifdef __cplusplus
1360
+ }
1361
+ #endif
1362
+
1363
+
1364
+ /* -----------------------------------------------------------------------------
1365
+ * rubyrun.swg
1366
+ *
1367
+ * This file contains the runtime support for Ruby modules
1368
+ * and includes code for managing global variables and pointer
1369
+ * type checking.
1370
+ * ----------------------------------------------------------------------------- */
1371
+
1372
+ /* For backward compatibility only */
1373
+ #define SWIG_POINTER_EXCEPTION 0
1374
+
1375
+ /* for raw pointers */
1376
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1377
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1378
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1379
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1380
+ #define swig_owntype ruby_owntype
1381
+
1382
+ /* for raw packed data */
1383
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1384
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1385
+
1386
+ /* for class or struct pointers */
1387
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1388
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1389
+
1390
+ /* for C or C++ function pointers */
1391
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1392
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1393
+
1394
+ /* for C++ member pointers, ie, member methods */
1395
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1396
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1397
+
1398
+
1399
+ /* Runtime API */
1400
+
1401
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1402
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1403
+
1404
+
1405
+ /* Error manipulation */
1406
+
1407
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1408
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1409
+ #define SWIG_fail goto fail
1410
+
1411
+
1412
+ /* Ruby-specific SWIG API */
1413
+
1414
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1415
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1416
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1417
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1418
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1419
+
1420
+ #include "assert.h"
1421
+
1422
+ /* -----------------------------------------------------------------------------
1423
+ * pointers/data manipulation
1424
+ * ----------------------------------------------------------------------------- */
1425
+
1426
+ #ifdef __cplusplus
1427
+ extern "C" {
1428
+ #endif
1429
+
1430
+ typedef struct {
1431
+ VALUE klass;
1432
+ VALUE mImpl;
1433
+ void (*mark)(void *);
1434
+ void (*destroy)(void *);
1435
+ int trackObjects;
1436
+ } swig_class;
1437
+
1438
+
1439
+ /* Global pointer used to keep some internal SWIG stuff */
1440
+ static VALUE _cSWIG_Pointer = Qnil;
1441
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1442
+
1443
+ /* Global IDs used to keep some internal SWIG stuff */
1444
+ static ID swig_arity_id = 0;
1445
+ static ID swig_call_id = 0;
1446
+
1447
+ /*
1448
+ If your swig extension is to be run within an embedded ruby and has
1449
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1450
+ This will reset ruby's stack frame on each entry point from the main
1451
+ program the first time a virtual director function is invoked (in a
1452
+ non-recursive way).
1453
+ If this is not done, you run the risk of Ruby trashing the stack.
1454
+ */
1455
+
1456
+ #ifdef RUBY_EMBEDDED
1457
+
1458
+ # define SWIG_INIT_STACK \
1459
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1460
+ ++swig_virtual_calls;
1461
+ # define SWIG_RELEASE_STACK --swig_virtual_calls;
1462
+ # define Ruby_DirectorTypeMismatchException(x) \
1463
+ rb_raise( rb_eTypeError, "%s", x ); return c_result;
1464
+
1465
+ static unsigned int swig_virtual_calls = 0;
1466
+
1467
+ #else /* normal non-embedded extension */
1468
+
1469
+ # define SWIG_INIT_STACK
1470
+ # define SWIG_RELEASE_STACK
1471
+ # define Ruby_DirectorTypeMismatchException(x) \
1472
+ throw Swig::DirectorTypeMismatchException( x );
1473
+
1474
+ #endif /* RUBY_EMBEDDED */
1475
+
1476
+
1477
+ SWIGRUNTIME VALUE
1478
+ getExceptionClass(void) {
1479
+ static int init = 0;
1480
+ static VALUE rubyExceptionClass ;
1481
+ if (!init) {
1482
+ init = 1;
1483
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1484
+ }
1485
+ return rubyExceptionClass;
1486
+ }
1487
+
1488
+ /* This code checks to see if the Ruby object being raised as part
1489
+ of an exception inherits from the Ruby class Exception. If so,
1490
+ the object is simply returned. If not, then a new Ruby exception
1491
+ object is created and that will be returned to Ruby.*/
1492
+ SWIGRUNTIME VALUE
1493
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1494
+ VALUE exceptionClass = getExceptionClass();
1495
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1496
+ return obj;
1497
+ } else {
1498
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1499
+ }
1500
+ }
1501
+
1502
+ /* Initialize Ruby runtime support */
1503
+ SWIGRUNTIME void
1504
+ SWIG_Ruby_InitRuntime(void)
1505
+ {
1506
+ if (_mSWIG == Qnil) {
1507
+ _mSWIG = rb_define_module("SWIG");
1508
+ swig_call_id = rb_intern("call");
1509
+ swig_arity_id = rb_intern("arity");
1510
+ }
1511
+ }
1512
+
1513
+ /* Define Ruby class for C type */
1514
+ SWIGRUNTIME void
1515
+ SWIG_Ruby_define_class(swig_type_info *type)
1516
+ {
1517
+ VALUE klass;
1518
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1519
+ sprintf(klass_name, "TYPE%s", type->name);
1520
+ if (NIL_P(_cSWIG_Pointer)) {
1521
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1522
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1523
+ }
1524
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1525
+ free((void *) klass_name);
1526
+ }
1527
+
1528
+ /* Create a new pointer object */
1529
+ SWIGRUNTIME VALUE
1530
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1531
+ {
1532
+ int own = flags & SWIG_POINTER_OWN;
1533
+ int track;
1534
+ char *klass_name;
1535
+ swig_class *sklass;
1536
+ VALUE klass;
1537
+ VALUE obj;
1538
+
1539
+ if (!ptr)
1540
+ return Qnil;
1541
+
1542
+ if (type->clientdata) {
1543
+ sklass = (swig_class *) type->clientdata;
1544
+
1545
+ /* Are we tracking this class and have we already returned this Ruby object? */
1546
+ track = sklass->trackObjects;
1547
+ if (track) {
1548
+ obj = SWIG_RubyInstanceFor(ptr);
1549
+
1550
+ /* Check the object's type and make sure it has the correct type.
1551
+ It might not in cases where methods do things like
1552
+ downcast methods. */
1553
+ if (obj != Qnil) {
1554
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
1555
+ const char* type_name = RSTRING_PTR(value);
1556
+
1557
+ if (strcmp(type->name, type_name) == 0) {
1558
+ return obj;
1559
+ }
1560
+ }
1561
+ }
1562
+
1563
+ /* Create a new Ruby object */
1564
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1565
+ ( own ? VOIDFUNC(sklass->destroy) :
1566
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1567
+ ), ptr);
1568
+
1569
+ /* If tracking is on for this class then track this object. */
1570
+ if (track) {
1571
+ SWIG_RubyAddTracking(ptr, obj);
1572
+ }
1573
+ } else {
1574
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1575
+ sprintf(klass_name, "TYPE%s", type->name);
1576
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1577
+ free((void *) klass_name);
1578
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1579
+ }
1580
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1581
+
1582
+ return obj;
1583
+ }
1584
+
1585
+ /* Create a new class instance (always owned) */
1586
+ SWIGRUNTIME VALUE
1587
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1588
+ {
1589
+ VALUE obj;
1590
+ swig_class *sklass = (swig_class *) type->clientdata;
1591
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1592
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1593
+ return obj;
1594
+ }
1595
+
1596
+ /* Get type mangle from class name */
1597
+ SWIGRUNTIMEINLINE char *
1598
+ SWIG_Ruby_MangleStr(VALUE obj)
1599
+ {
1600
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
1601
+ return StringValuePtr(stype);
1602
+ }
1603
+
1604
+ /* Acquire a pointer value */
1605
+ typedef void (*ruby_owntype)(void*);
1606
+
1607
+ SWIGRUNTIME ruby_owntype
1608
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1609
+ if (obj) {
1610
+ ruby_owntype oldown = RDATA(obj)->dfree;
1611
+ RDATA(obj)->dfree = own;
1612
+ return oldown;
1613
+ } else {
1614
+ return 0;
1615
+ }
1616
+ }
1617
+
1618
+ /* Convert a pointer value */
1619
+ SWIGRUNTIME int
1620
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1621
+ {
1622
+ char *c;
1623
+ swig_cast_info *tc;
1624
+ void *vptr = 0;
1625
+
1626
+ /* Grab the pointer */
1627
+ if (NIL_P(obj)) {
1628
+ *ptr = 0;
1629
+ return SWIG_OK;
1630
+ } else {
1631
+ if (TYPE(obj) != T_DATA) {
1632
+ return SWIG_ERROR;
1633
+ }
1634
+ Data_Get_Struct(obj, void, vptr);
1635
+ }
1636
+
1637
+ if (own) *own = RDATA(obj)->dfree;
1638
+
1639
+ /* Check to see if the input object is giving up ownership
1640
+ of the underlying C struct or C++ object. If so then we
1641
+ need to reset the destructor since the Ruby object no
1642
+ longer owns the underlying C++ object.*/
1643
+ if (flags & SWIG_POINTER_DISOWN) {
1644
+ /* Is tracking on for this class? */
1645
+ int track = 0;
1646
+ if (ty && ty->clientdata) {
1647
+ swig_class *sklass = (swig_class *) ty->clientdata;
1648
+ track = sklass->trackObjects;
1649
+ }
1650
+
1651
+ if (track) {
1652
+ /* We are tracking objects for this class. Thus we change the destructor
1653
+ * to SWIG_RubyRemoveTracking. This allows us to
1654
+ * remove the mapping from the C++ to Ruby object
1655
+ * when the Ruby object is garbage collected. If we don't
1656
+ * do this, then it is possible we will return a reference
1657
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1658
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1659
+ } else {
1660
+ RDATA(obj)->dfree = 0;
1661
+ }
1662
+ }
1663
+
1664
+ /* Do type-checking if type info was provided */
1665
+ if (ty) {
1666
+ if (ty->clientdata) {
1667
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1668
+ if (vptr == 0) {
1669
+ /* The object has already been deleted */
1670
+ return SWIG_ObjectPreviouslyDeletedError;
1671
+ }
1672
+ *ptr = vptr;
1673
+ return SWIG_OK;
1674
+ }
1675
+ }
1676
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1677
+ return SWIG_ERROR;
1678
+ }
1679
+ tc = SWIG_TypeCheck(c, ty);
1680
+ if (!tc) {
1681
+ return SWIG_ERROR;
1682
+ } else {
1683
+ int newmemory = 0;
1684
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1685
+ assert(!newmemory); /* newmemory handling not yet implemented */
1686
+ }
1687
+ } else {
1688
+ *ptr = vptr;
1689
+ }
1690
+
1691
+ return SWIG_OK;
1692
+ }
1693
+
1694
+ /* Check convert */
1695
+ SWIGRUNTIMEINLINE int
1696
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1697
+ {
1698
+ char *c = SWIG_MangleStr(obj);
1699
+ if (!c) return 0;
1700
+ return SWIG_TypeCheck(c,ty) != 0;
1701
+ }
1702
+
1703
+ SWIGRUNTIME VALUE
1704
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1705
+ char result[1024];
1706
+ char *r = result;
1707
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1708
+ *(r++) = '_';
1709
+ r = SWIG_PackData(r, ptr, sz);
1710
+ strcpy(r, type->name);
1711
+ return rb_str_new2(result);
1712
+ }
1713
+
1714
+ /* Convert a packed value value */
1715
+ SWIGRUNTIME int
1716
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1717
+ swig_cast_info *tc;
1718
+ const char *c;
1719
+
1720
+ if (TYPE(obj) != T_STRING) goto type_error;
1721
+ c = StringValuePtr(obj);
1722
+ /* Pointer values must start with leading underscore */
1723
+ if (*c != '_') goto type_error;
1724
+ c++;
1725
+ c = SWIG_UnpackData(c, ptr, sz);
1726
+ if (ty) {
1727
+ tc = SWIG_TypeCheck(c, ty);
1728
+ if (!tc) goto type_error;
1729
+ }
1730
+ return SWIG_OK;
1731
+
1732
+ type_error:
1733
+ return SWIG_ERROR;
1734
+ }
1735
+
1736
+ SWIGRUNTIME swig_module_info *
1737
+ SWIG_Ruby_GetModule(void)
1738
+ {
1739
+ VALUE pointer;
1740
+ swig_module_info *ret = 0;
1741
+ VALUE verbose = rb_gv_get("VERBOSE");
1742
+
1743
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1744
+ rb_gv_set("VERBOSE", Qfalse);
1745
+
1746
+ /* first check if pointer already created */
1747
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1748
+ if (pointer != Qnil) {
1749
+ Data_Get_Struct(pointer, swig_module_info, ret);
1750
+ }
1751
+
1752
+ /* reinstate warnings */
1753
+ rb_gv_set("VERBOSE", verbose);
1754
+ return ret;
1755
+ }
1756
+
1757
+ SWIGRUNTIME void
1758
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1759
+ {
1760
+ /* register a new class */
1761
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1762
+ /* create and store the structure pointer to a global variable */
1763
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1764
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1765
+ }
1766
+
1767
+ /* This function can be used to check whether a proc or method or similarly
1768
+ callable function has been passed. Usually used in a %typecheck, like:
1769
+
1770
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1771
+ $result = SWIG_Ruby_isCallable( $input );
1772
+ }
1773
+ */
1774
+ SWIGINTERN
1775
+ int SWIG_Ruby_isCallable( VALUE proc )
1776
+ {
1777
+ if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1778
+ return 1;
1779
+ return 0;
1780
+ }
1781
+
1782
+ /* This function can be used to check the arity (number of arguments)
1783
+ a proc or method can take. Usually used in a %typecheck.
1784
+ Valid arities will be that equal to minimal or those < 0
1785
+ which indicate a variable number of parameters at the end.
1786
+ */
1787
+ SWIGINTERN
1788
+ int SWIG_Ruby_arity( VALUE proc, int minimal )
1789
+ {
1790
+ if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1791
+ {
1792
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1793
+ int arity = NUM2INT(num);
1794
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
1795
+ if ( arity == minimal ) return 1;
1796
+ return 1;
1797
+ }
1798
+ return 0;
1799
+ }
1800
+
1801
+
1802
+ #ifdef __cplusplus
1803
+ }
1804
+ #endif
1805
+
1806
+
1807
+
1808
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1809
+
1810
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1811
+
1812
+
1813
+
1814
+ /* -------- TYPES TABLE (BEGIN) -------- */
1815
+
1816
+ #define SWIGTYPE_p_Context swig_types[0]
1817
+ #define SWIGTYPE_p_Event swig_types[1]
1818
+ #define SWIGTYPE_p_FileReporter swig_types[2]
1819
+ #define SWIGTYPE_p_Metadata swig_types[3]
1820
+ #define SWIGTYPE_p_UdpReporter swig_types[4]
1821
+ #define SWIGTYPE_p_char swig_types[5]
1822
+ #define SWIGTYPE_p_oboe_metadata_t swig_types[6]
1823
+ static swig_type_info *swig_types[8];
1824
+ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
1825
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1826
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1827
+
1828
+ /* -------- TYPES TABLE (END) -------- */
1829
+
1830
+ #define SWIG_init Init_oboe_metal
1831
+ #define SWIG_name "Oboe_metal"
1832
+
1833
+ static VALUE mOboe_metal;
1834
+
1835
+ #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1836
+ #define SWIG_RUBY_THREAD_END_BLOCK
1837
+
1838
+
1839
+ #define SWIGVERSION 0x020008
1840
+ #define SWIG_VERSION SWIGVERSION
1841
+
1842
+
1843
+ #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1844
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1845
+
1846
+
1847
+ #include <stdexcept>
1848
+
1849
+
1850
+ #include "oboe.hpp"
1851
+
1852
+
1853
+ #include <string>
1854
+
1855
+
1856
+ SWIGINTERN swig_type_info*
1857
+ SWIG_pchar_descriptor(void)
1858
+ {
1859
+ static int init = 0;
1860
+ static swig_type_info* info = 0;
1861
+ if (!init) {
1862
+ info = SWIG_TypeQuery("_p_char");
1863
+ init = 1;
1864
+ }
1865
+ return info;
1866
+ }
1867
+
1868
+
1869
+ SWIGINTERN int
1870
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1871
+ {
1872
+ if (TYPE(obj) == T_STRING) {
1873
+ #if defined(StringValuePtr)
1874
+ char *cstr = StringValuePtr(obj);
1875
+ #else
1876
+ char *cstr = STR2CSTR(obj);
1877
+ #endif
1878
+ size_t size = RSTRING_LEN(obj) + 1;
1879
+ if (cptr) {
1880
+ if (alloc) {
1881
+ if (*alloc == SWIG_NEWOBJ) {
1882
+ *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
1883
+ } else {
1884
+ *cptr = cstr;
1885
+ *alloc = SWIG_OLDOBJ;
1886
+ }
1887
+ }
1888
+ }
1889
+ if (psize) *psize = size;
1890
+ return SWIG_OK;
1891
+ } else {
1892
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1893
+ if (pchar_descriptor) {
1894
+ void* vptr = 0;
1895
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1896
+ if (cptr) *cptr = (char *)vptr;
1897
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1898
+ if (alloc) *alloc = SWIG_OLDOBJ;
1899
+ return SWIG_OK;
1900
+ }
1901
+ }
1902
+ }
1903
+ return SWIG_TypeError;
1904
+ }
1905
+
1906
+
1907
+ SWIGINTERN int
1908
+ SWIG_AsPtr_std_string (VALUE obj, std::string **val)
1909
+ {
1910
+ char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
1911
+ if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
1912
+ if (buf) {
1913
+ if (val) *val = new std::string(buf, size - 1);
1914
+ if (alloc == SWIG_NEWOBJ) delete[] buf;
1915
+ return SWIG_NEWOBJ;
1916
+ } else {
1917
+ if (val) *val = 0;
1918
+ return SWIG_OLDOBJ;
1919
+ }
1920
+ } else {
1921
+ static int init = 0;
1922
+ static swig_type_info* descriptor = 0;
1923
+ if (!init) {
1924
+ descriptor = SWIG_TypeQuery("std::string" " *");
1925
+ init = 1;
1926
+ }
1927
+ if (descriptor) {
1928
+ std::string *vptr;
1929
+ int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
1930
+ if (SWIG_IsOK(res) && val) *val = vptr;
1931
+ return res;
1932
+ }
1933
+ }
1934
+ return SWIG_ERROR;
1935
+ }
1936
+
1937
+
1938
+ SWIGINTERNINLINE VALUE
1939
+ SWIG_From_bool (bool value)
1940
+ {
1941
+ return value ? Qtrue : Qfalse;
1942
+ }
1943
+
1944
+
1945
+ SWIGINTERNINLINE VALUE
1946
+ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1947
+ {
1948
+ if (carray) {
1949
+ if (size > LONG_MAX) {
1950
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1951
+ return pchar_descriptor ?
1952
+ SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
1953
+ } else {
1954
+ return rb_str_new(carray, static_cast< long >(size));
1955
+ }
1956
+ } else {
1957
+ return Qnil;
1958
+ }
1959
+ }
1960
+
1961
+
1962
+ SWIGINTERNINLINE VALUE
1963
+ SWIG_From_std_string (const std::string& s)
1964
+ {
1965
+ return SWIG_FromCharPtrAndSize(s.data(), s.size());
1966
+ }
1967
+
1968
+
1969
+
1970
+
1971
+
1972
+ SWIGINTERN VALUE
1973
+ SWIG_ruby_failed(void)
1974
+ {
1975
+ return Qnil;
1976
+ }
1977
+
1978
+
1979
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1980
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1981
+ {
1982
+ VALUE obj = args[0];
1983
+ VALUE type = TYPE(obj);
1984
+ long *res = (long *)(args[1]);
1985
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1986
+ return obj;
1987
+ }
1988
+ /*@SWIG@*/
1989
+
1990
+ SWIGINTERN int
1991
+ SWIG_AsVal_long (VALUE obj, long* val)
1992
+ {
1993
+ VALUE type = TYPE(obj);
1994
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1995
+ long v;
1996
+ VALUE a[2];
1997
+ a[0] = obj;
1998
+ a[1] = (VALUE)(&v);
1999
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2000
+ if (val) *val = v;
2001
+ return SWIG_OK;
2002
+ }
2003
+ }
2004
+ return SWIG_TypeError;
2005
+ }
2006
+
2007
+
2008
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2009
+ SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
2010
+ {
2011
+ VALUE obj = args[0];
2012
+ VALUE type = TYPE(obj);
2013
+ double *res = (double *)(args[1]);
2014
+ *res = NUM2DBL(obj);
2015
+ return obj;
2016
+ }
2017
+ /*@SWIG@*/
2018
+
2019
+ SWIGINTERN int
2020
+ SWIG_AsVal_double (VALUE obj, double *val)
2021
+ {
2022
+ VALUE type = TYPE(obj);
2023
+ if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
2024
+ double v;
2025
+ VALUE a[2];
2026
+ a[0] = obj;
2027
+ a[1] = (VALUE)(&v);
2028
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2029
+ if (val) *val = v;
2030
+ return SWIG_OK;
2031
+ }
2032
+ }
2033
+ return SWIG_TypeError;
2034
+ }
2035
+
2036
+ static swig_class SwigClassMetadata;
2037
+
2038
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2039
+ SWIGINTERN VALUE
2040
+ _wrap_Metadata_allocate(VALUE self) {
2041
+ #else
2042
+ SWIGINTERN VALUE
2043
+ _wrap_Metadata_allocate(int argc, VALUE *argv, VALUE self) {
2044
+ #endif
2045
+
2046
+
2047
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Metadata);
2048
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2049
+ rb_obj_call_init(vresult, argc, argv);
2050
+ #endif
2051
+ return vresult;
2052
+ }
2053
+
2054
+
2055
+ SWIGINTERN VALUE
2056
+ _wrap_new_Metadata(int argc, VALUE *argv, VALUE self) {
2057
+ oboe_metadata_t *arg1 = (oboe_metadata_t *) 0 ;
2058
+ void *argp1 = 0 ;
2059
+ int res1 = 0 ;
2060
+ Metadata *result = 0 ;
2061
+
2062
+ if ((argc < 1) || (argc > 1)) {
2063
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2064
+ }
2065
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2066
+ if (!SWIG_IsOK(res1)) {
2067
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "oboe_metadata_t *","Metadata", 1, argv[0] ));
2068
+ }
2069
+ arg1 = reinterpret_cast< oboe_metadata_t * >(argp1);
2070
+ result = (Metadata *)new Metadata(arg1);
2071
+ DATA_PTR(self) = result;
2072
+ return self;
2073
+ fail:
2074
+ return Qnil;
2075
+ }
2076
+
2077
+
2078
+ SWIGINTERN void
2079
+ free_Metadata(Metadata *arg1) {
2080
+ delete arg1;
2081
+ }
2082
+
2083
+ SWIGINTERN VALUE
2084
+ _wrap_Metadata_fromString(int argc, VALUE *argv, VALUE self) {
2085
+ std::string arg1 ;
2086
+ Metadata *result = 0 ;
2087
+ VALUE vresult = Qnil;
2088
+
2089
+ if ((argc < 1) || (argc > 1)) {
2090
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2091
+ }
2092
+ {
2093
+ std::string *ptr = (std::string *)0;
2094
+ int res = SWIG_AsPtr_std_string(argv[0], &ptr);
2095
+ if (!SWIG_IsOK(res) || !ptr) {
2096
+ SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","Metadata::fromString", 1, argv[0] ));
2097
+ }
2098
+ arg1 = *ptr;
2099
+ if (SWIG_IsNewObj(res)) delete ptr;
2100
+ }
2101
+ result = (Metadata *)Metadata::fromString(arg1);
2102
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Metadata, 0 | 0 );
2103
+ return vresult;
2104
+ fail:
2105
+ return Qnil;
2106
+ }
2107
+
2108
+
2109
+ SWIGINTERN VALUE
2110
+ _wrap_Metadata_createEvent(int argc, VALUE *argv, VALUE self) {
2111
+ Metadata *arg1 = (Metadata *) 0 ;
2112
+ void *argp1 = 0 ;
2113
+ int res1 = 0 ;
2114
+ Event *result = 0 ;
2115
+ VALUE vresult = Qnil;
2116
+
2117
+ if ((argc < 0) || (argc > 0)) {
2118
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2119
+ }
2120
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Metadata, 0 | 0 );
2121
+ if (!SWIG_IsOK(res1)) {
2122
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Metadata *","createEvent", 1, self ));
2123
+ }
2124
+ arg1 = reinterpret_cast< Metadata * >(argp1);
2125
+ result = (Event *)(arg1)->createEvent();
2126
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN | 0 );
2127
+ return vresult;
2128
+ fail:
2129
+ return Qnil;
2130
+ }
2131
+
2132
+
2133
+ SWIGINTERN VALUE
2134
+ _wrap_Metadata_makeRandom(int argc, VALUE *argv, VALUE self) {
2135
+ Metadata *result = 0 ;
2136
+ VALUE vresult = Qnil;
2137
+
2138
+ if ((argc < 0) || (argc > 0)) {
2139
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2140
+ }
2141
+ result = (Metadata *)Metadata::makeRandom();
2142
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Metadata, SWIG_POINTER_OWN | 0 );
2143
+ return vresult;
2144
+ fail:
2145
+ return Qnil;
2146
+ }
2147
+
2148
+
2149
+ SWIGINTERN VALUE
2150
+ _wrap_Metadata_copy(int argc, VALUE *argv, VALUE self) {
2151
+ Metadata *arg1 = (Metadata *) 0 ;
2152
+ void *argp1 = 0 ;
2153
+ int res1 = 0 ;
2154
+ Metadata *result = 0 ;
2155
+ VALUE vresult = Qnil;
2156
+
2157
+ if ((argc < 0) || (argc > 0)) {
2158
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2159
+ }
2160
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Metadata, 0 | 0 );
2161
+ if (!SWIG_IsOK(res1)) {
2162
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Metadata *","copy", 1, self ));
2163
+ }
2164
+ arg1 = reinterpret_cast< Metadata * >(argp1);
2165
+ result = (Metadata *)(arg1)->copy();
2166
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Metadata, SWIG_POINTER_OWN | 0 );
2167
+ return vresult;
2168
+ fail:
2169
+ return Qnil;
2170
+ }
2171
+
2172
+
2173
+ SWIGINTERN VALUE
2174
+ _wrap_Metadata_isValid(int argc, VALUE *argv, VALUE self) {
2175
+ Metadata *arg1 = (Metadata *) 0 ;
2176
+ void *argp1 = 0 ;
2177
+ int res1 = 0 ;
2178
+ bool result;
2179
+ VALUE vresult = Qnil;
2180
+
2181
+ if ((argc < 0) || (argc > 0)) {
2182
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2183
+ }
2184
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Metadata, 0 | 0 );
2185
+ if (!SWIG_IsOK(res1)) {
2186
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Metadata *","isValid", 1, self ));
2187
+ }
2188
+ arg1 = reinterpret_cast< Metadata * >(argp1);
2189
+ result = (bool)(arg1)->isValid();
2190
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2191
+ return vresult;
2192
+ fail:
2193
+ return Qnil;
2194
+ }
2195
+
2196
+
2197
+ SWIGINTERN VALUE
2198
+ _wrap_Metadata_toString(int argc, VALUE *argv, VALUE self) {
2199
+ Metadata *arg1 = (Metadata *) 0 ;
2200
+ void *argp1 = 0 ;
2201
+ int res1 = 0 ;
2202
+ std::string result;
2203
+ VALUE vresult = Qnil;
2204
+
2205
+ if ((argc < 0) || (argc > 0)) {
2206
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2207
+ }
2208
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Metadata, 0 | 0 );
2209
+ if (!SWIG_IsOK(res1)) {
2210
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Metadata *","toString", 1, self ));
2211
+ }
2212
+ arg1 = reinterpret_cast< Metadata * >(argp1);
2213
+ result = (arg1)->toString();
2214
+ vresult = SWIG_From_std_string(static_cast< std::string >(result));
2215
+ return vresult;
2216
+ fail:
2217
+ return Qnil;
2218
+ }
2219
+
2220
+
2221
+ static swig_class SwigClassContext;
2222
+
2223
+ SWIGINTERN VALUE
2224
+ _wrap_Context_get(int argc, VALUE *argv, VALUE self) {
2225
+ oboe_metadata_t *result = 0 ;
2226
+ VALUE vresult = Qnil;
2227
+
2228
+ if ((argc < 0) || (argc > 0)) {
2229
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2230
+ }
2231
+ result = (oboe_metadata_t *)Context::get();
2232
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2233
+ return vresult;
2234
+ fail:
2235
+ return Qnil;
2236
+ }
2237
+
2238
+
2239
+ SWIGINTERN VALUE
2240
+ _wrap_Context_toString(int argc, VALUE *argv, VALUE self) {
2241
+ std::string result;
2242
+ VALUE vresult = Qnil;
2243
+
2244
+ if ((argc < 0) || (argc > 0)) {
2245
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2246
+ }
2247
+ result = Context::toString();
2248
+ vresult = SWIG_From_std_string(static_cast< std::string >(result));
2249
+ return vresult;
2250
+ fail:
2251
+ return Qnil;
2252
+ }
2253
+
2254
+
2255
+ SWIGINTERN VALUE
2256
+ _wrap_Context_set(int argc, VALUE *argv, VALUE self) {
2257
+ oboe_metadata_t *arg1 = (oboe_metadata_t *) 0 ;
2258
+ void *argp1 = 0 ;
2259
+ int res1 = 0 ;
2260
+
2261
+ if ((argc < 1) || (argc > 1)) {
2262
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2263
+ }
2264
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2265
+ if (!SWIG_IsOK(res1)) {
2266
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "oboe_metadata_t *","Context::set", 1, argv[0] ));
2267
+ }
2268
+ arg1 = reinterpret_cast< oboe_metadata_t * >(argp1);
2269
+ Context::set(arg1);
2270
+ return Qnil;
2271
+ fail:
2272
+ return Qnil;
2273
+ }
2274
+
2275
+
2276
+ SWIGINTERN VALUE
2277
+ _wrap_Context_fromString(int argc, VALUE *argv, VALUE self) {
2278
+ std::string arg1 ;
2279
+
2280
+ if ((argc < 1) || (argc > 1)) {
2281
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2282
+ }
2283
+ {
2284
+ std::string *ptr = (std::string *)0;
2285
+ int res = SWIG_AsPtr_std_string(argv[0], &ptr);
2286
+ if (!SWIG_IsOK(res) || !ptr) {
2287
+ SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","Context::fromString", 1, argv[0] ));
2288
+ }
2289
+ arg1 = *ptr;
2290
+ if (SWIG_IsNewObj(res)) delete ptr;
2291
+ }
2292
+ Context::fromString(arg1);
2293
+ return Qnil;
2294
+ fail:
2295
+ return Qnil;
2296
+ }
2297
+
2298
+
2299
+ SWIGINTERN VALUE
2300
+ _wrap_Context_copy(int argc, VALUE *argv, VALUE self) {
2301
+ Metadata *result = 0 ;
2302
+ VALUE vresult = Qnil;
2303
+
2304
+ if ((argc < 0) || (argc > 0)) {
2305
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2306
+ }
2307
+ result = (Metadata *)Context::copy();
2308
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Metadata, SWIG_POINTER_OWN | 0 );
2309
+ return vresult;
2310
+ fail:
2311
+ return Qnil;
2312
+ }
2313
+
2314
+
2315
+ SWIGINTERN VALUE
2316
+ _wrap_Context_clear(int argc, VALUE *argv, VALUE self) {
2317
+ if ((argc < 0) || (argc > 0)) {
2318
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2319
+ }
2320
+ Context::clear();
2321
+ return Qnil;
2322
+ fail:
2323
+ return Qnil;
2324
+ }
2325
+
2326
+
2327
+ SWIGINTERN VALUE
2328
+ _wrap_Context_isValid(int argc, VALUE *argv, VALUE self) {
2329
+ bool result;
2330
+ VALUE vresult = Qnil;
2331
+
2332
+ if ((argc < 0) || (argc > 0)) {
2333
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2334
+ }
2335
+ result = (bool)Context::isValid();
2336
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2337
+ return vresult;
2338
+ fail:
2339
+ return Qnil;
2340
+ }
2341
+
2342
+
2343
+ SWIGINTERN VALUE
2344
+ _wrap_Context_init(int argc, VALUE *argv, VALUE self) {
2345
+ if ((argc < 0) || (argc > 0)) {
2346
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2347
+ }
2348
+ Context::init();
2349
+ return Qnil;
2350
+ fail:
2351
+ return Qnil;
2352
+ }
2353
+
2354
+
2355
+ SWIGINTERN VALUE
2356
+ _wrap_Context_createEvent(int argc, VALUE *argv, VALUE self) {
2357
+ Event *result = 0 ;
2358
+ VALUE vresult = Qnil;
2359
+
2360
+ if ((argc < 0) || (argc > 0)) {
2361
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2362
+ }
2363
+ result = (Event *)Context::createEvent();
2364
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN | 0 );
2365
+ return vresult;
2366
+ fail:
2367
+ return Qnil;
2368
+ }
2369
+
2370
+
2371
+ SWIGINTERN VALUE
2372
+ _wrap_Context_startTrace(int argc, VALUE *argv, VALUE self) {
2373
+ Event *result = 0 ;
2374
+ VALUE vresult = Qnil;
2375
+
2376
+ if ((argc < 0) || (argc > 0)) {
2377
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2378
+ }
2379
+ result = (Event *)Context::startTrace();
2380
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN | 0 );
2381
+ return vresult;
2382
+ fail:
2383
+ return Qnil;
2384
+ }
2385
+
2386
+
2387
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2388
+ SWIGINTERN VALUE
2389
+ _wrap_Context_allocate(VALUE self) {
2390
+ #else
2391
+ SWIGINTERN VALUE
2392
+ _wrap_Context_allocate(int argc, VALUE *argv, VALUE self) {
2393
+ #endif
2394
+
2395
+
2396
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Context);
2397
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2398
+ rb_obj_call_init(vresult, argc, argv);
2399
+ #endif
2400
+ return vresult;
2401
+ }
2402
+
2403
+
2404
+ SWIGINTERN VALUE
2405
+ _wrap_new_Context(int argc, VALUE *argv, VALUE self) {
2406
+ Context *result = 0 ;
2407
+
2408
+ if ((argc < 0) || (argc > 0)) {
2409
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2410
+ }
2411
+ result = (Context *)new Context();
2412
+ DATA_PTR(self) = result;
2413
+ return self;
2414
+ fail:
2415
+ return Qnil;
2416
+ }
2417
+
2418
+
2419
+ SWIGINTERN void
2420
+ free_Context(Context *arg1) {
2421
+ delete arg1;
2422
+ }
2423
+
2424
+ static swig_class SwigClassEvent;
2425
+
2426
+ SWIGINTERN void
2427
+ free_Event(Event *arg1) {
2428
+ delete arg1;
2429
+ }
2430
+
2431
+ SWIGINTERN VALUE
2432
+ _wrap_Event_addInfo__SWIG_0(int argc, VALUE *argv, VALUE self) {
2433
+ Event *arg1 = (Event *) 0 ;
2434
+ char *arg2 = (char *) 0 ;
2435
+ void *arg3 = (void *) 0 ;
2436
+ void *argp1 = 0 ;
2437
+ int res1 = 0 ;
2438
+ int res2 ;
2439
+ char *buf2 = 0 ;
2440
+ int alloc2 = 0 ;
2441
+ int res3 ;
2442
+ bool result;
2443
+ VALUE vresult = Qnil;
2444
+
2445
+ if ((argc < 2) || (argc > 2)) {
2446
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2447
+ }
2448
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2449
+ if (!SWIG_IsOK(res1)) {
2450
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","addInfo", 1, self ));
2451
+ }
2452
+ arg1 = reinterpret_cast< Event * >(argp1);
2453
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
2454
+ if (!SWIG_IsOK(res2)) {
2455
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
2456
+ }
2457
+ arg2 = reinterpret_cast< char * >(buf2);
2458
+ res3 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg3), 0, 0);
2459
+ if (!SWIG_IsOK(res3)) {
2460
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","addInfo", 3, argv[1] ));
2461
+ }
2462
+ result = (bool)(arg1)->addInfo(arg2,arg3);
2463
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2464
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2465
+ return vresult;
2466
+ fail:
2467
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2468
+ return Qnil;
2469
+ }
2470
+
2471
+
2472
+ SWIGINTERN VALUE
2473
+ _wrap_Event_addInfo__SWIG_1(int argc, VALUE *argv, VALUE self) {
2474
+ Event *arg1 = (Event *) 0 ;
2475
+ char *arg2 = (char *) 0 ;
2476
+ std::string *arg3 = 0 ;
2477
+ void *argp1 = 0 ;
2478
+ int res1 = 0 ;
2479
+ int res2 ;
2480
+ char *buf2 = 0 ;
2481
+ int alloc2 = 0 ;
2482
+ int res3 = SWIG_OLDOBJ ;
2483
+ bool result;
2484
+ VALUE vresult = Qnil;
2485
+
2486
+ if ((argc < 2) || (argc > 2)) {
2487
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2488
+ }
2489
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2490
+ if (!SWIG_IsOK(res1)) {
2491
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","addInfo", 1, self ));
2492
+ }
2493
+ arg1 = reinterpret_cast< Event * >(argp1);
2494
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
2495
+ if (!SWIG_IsOK(res2)) {
2496
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
2497
+ }
2498
+ arg2 = reinterpret_cast< char * >(buf2);
2499
+ {
2500
+ std::string *ptr = (std::string *)0;
2501
+ res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
2502
+ if (!SWIG_IsOK(res3)) {
2503
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","addInfo", 3, argv[1] ));
2504
+ }
2505
+ if (!ptr) {
2506
+ SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","addInfo", 3, argv[1]));
2507
+ }
2508
+ arg3 = ptr;
2509
+ }
2510
+ result = (bool)(arg1)->addInfo(arg2,(std::string const &)*arg3);
2511
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2512
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2513
+ if (SWIG_IsNewObj(res3)) delete arg3;
2514
+ return vresult;
2515
+ fail:
2516
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2517
+ if (SWIG_IsNewObj(res3)) delete arg3;
2518
+ return Qnil;
2519
+ }
2520
+
2521
+
2522
+ SWIGINTERN VALUE
2523
+ _wrap_Event_addInfo__SWIG_2(int argc, VALUE *argv, VALUE self) {
2524
+ Event *arg1 = (Event *) 0 ;
2525
+ char *arg2 = (char *) 0 ;
2526
+ long arg3 ;
2527
+ void *argp1 = 0 ;
2528
+ int res1 = 0 ;
2529
+ int res2 ;
2530
+ char *buf2 = 0 ;
2531
+ int alloc2 = 0 ;
2532
+ long val3 ;
2533
+ int ecode3 = 0 ;
2534
+ bool result;
2535
+ VALUE vresult = Qnil;
2536
+
2537
+ if ((argc < 2) || (argc > 2)) {
2538
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2539
+ }
2540
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2541
+ if (!SWIG_IsOK(res1)) {
2542
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","addInfo", 1, self ));
2543
+ }
2544
+ arg1 = reinterpret_cast< Event * >(argp1);
2545
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
2546
+ if (!SWIG_IsOK(res2)) {
2547
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
2548
+ }
2549
+ arg2 = reinterpret_cast< char * >(buf2);
2550
+ ecode3 = SWIG_AsVal_long(argv[1], &val3);
2551
+ if (!SWIG_IsOK(ecode3)) {
2552
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "long","addInfo", 3, argv[1] ));
2553
+ }
2554
+ arg3 = static_cast< long >(val3);
2555
+ result = (bool)(arg1)->addInfo(arg2,arg3);
2556
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2557
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2558
+ return vresult;
2559
+ fail:
2560
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2561
+ return Qnil;
2562
+ }
2563
+
2564
+
2565
+ SWIGINTERN VALUE
2566
+ _wrap_Event_addInfo__SWIG_3(int argc, VALUE *argv, VALUE self) {
2567
+ Event *arg1 = (Event *) 0 ;
2568
+ char *arg2 = (char *) 0 ;
2569
+ double arg3 ;
2570
+ void *argp1 = 0 ;
2571
+ int res1 = 0 ;
2572
+ int res2 ;
2573
+ char *buf2 = 0 ;
2574
+ int alloc2 = 0 ;
2575
+ double val3 ;
2576
+ int ecode3 = 0 ;
2577
+ bool result;
2578
+ VALUE vresult = Qnil;
2579
+
2580
+ if ((argc < 2) || (argc > 2)) {
2581
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2582
+ }
2583
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2584
+ if (!SWIG_IsOK(res1)) {
2585
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","addInfo", 1, self ));
2586
+ }
2587
+ arg1 = reinterpret_cast< Event * >(argp1);
2588
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
2589
+ if (!SWIG_IsOK(res2)) {
2590
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
2591
+ }
2592
+ arg2 = reinterpret_cast< char * >(buf2);
2593
+ ecode3 = SWIG_AsVal_double(argv[1], &val3);
2594
+ if (!SWIG_IsOK(ecode3)) {
2595
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","addInfo", 3, argv[1] ));
2596
+ }
2597
+ arg3 = static_cast< double >(val3);
2598
+ result = (bool)(arg1)->addInfo(arg2,arg3);
2599
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2600
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2601
+ return vresult;
2602
+ fail:
2603
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2604
+ return Qnil;
2605
+ }
2606
+
2607
+
2608
+ SWIGINTERN VALUE _wrap_Event_addInfo(int nargs, VALUE *args, VALUE self) {
2609
+ int argc;
2610
+ VALUE argv[4];
2611
+ int ii;
2612
+
2613
+ argc = nargs + 1;
2614
+ argv[0] = self;
2615
+ if (argc > 4) SWIG_fail;
2616
+ for (ii = 1; (ii < argc); ++ii) {
2617
+ argv[ii] = args[ii-1];
2618
+ }
2619
+ if (argc == 3) {
2620
+ int _v;
2621
+ void *vptr = 0;
2622
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
2623
+ _v = SWIG_CheckState(res);
2624
+ if (_v) {
2625
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2626
+ _v = SWIG_CheckState(res);
2627
+ if (_v) {
2628
+ void *ptr = 0;
2629
+ int res = SWIG_ConvertPtr(argv[2], &ptr, 0, 0);
2630
+ _v = SWIG_CheckState(res);
2631
+ if (_v) {
2632
+ return _wrap_Event_addInfo__SWIG_0(nargs, args, self);
2633
+ }
2634
+ }
2635
+ }
2636
+ }
2637
+ if (argc == 3) {
2638
+ int _v;
2639
+ void *vptr = 0;
2640
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
2641
+ _v = SWIG_CheckState(res);
2642
+ if (_v) {
2643
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2644
+ _v = SWIG_CheckState(res);
2645
+ if (_v) {
2646
+ {
2647
+ int res = SWIG_AsVal_long(argv[2], NULL);
2648
+ _v = SWIG_CheckState(res);
2649
+ }
2650
+ if (_v) {
2651
+ return _wrap_Event_addInfo__SWIG_2(nargs, args, self);
2652
+ }
2653
+ }
2654
+ }
2655
+ }
2656
+ if (argc == 3) {
2657
+ int _v;
2658
+ void *vptr = 0;
2659
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
2660
+ _v = SWIG_CheckState(res);
2661
+ if (_v) {
2662
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2663
+ _v = SWIG_CheckState(res);
2664
+ if (_v) {
2665
+ {
2666
+ int res = SWIG_AsVal_double(argv[2], NULL);
2667
+ _v = SWIG_CheckState(res);
2668
+ }
2669
+ if (_v) {
2670
+ return _wrap_Event_addInfo__SWIG_3(nargs, args, self);
2671
+ }
2672
+ }
2673
+ }
2674
+ }
2675
+ if (argc == 3) {
2676
+ int _v;
2677
+ void *vptr = 0;
2678
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
2679
+ _v = SWIG_CheckState(res);
2680
+ if (_v) {
2681
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2682
+ _v = SWIG_CheckState(res);
2683
+ if (_v) {
2684
+ int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
2685
+ _v = SWIG_CheckState(res);
2686
+ if (_v) {
2687
+ return _wrap_Event_addInfo__SWIG_1(nargs, args, self);
2688
+ }
2689
+ }
2690
+ }
2691
+ }
2692
+
2693
+ fail:
2694
+ Ruby_Format_OverloadedError( argc, 4, "Event.addInfo",
2695
+ " bool Event.addInfo(char *key, void *val)\n"
2696
+ " bool Event.addInfo(char *key, std::string const &val)\n"
2697
+ " bool Event.addInfo(char *key, long val)\n"
2698
+ " bool Event.addInfo(char *key, double val)\n");
2699
+
2700
+ return Qnil;
2701
+ }
2702
+
2703
+
2704
+ SWIGINTERN VALUE
2705
+ _wrap_Event_addEdge(int argc, VALUE *argv, VALUE self) {
2706
+ Event *arg1 = (Event *) 0 ;
2707
+ oboe_metadata_t *arg2 = (oboe_metadata_t *) 0 ;
2708
+ void *argp1 = 0 ;
2709
+ int res1 = 0 ;
2710
+ void *argp2 = 0 ;
2711
+ int res2 = 0 ;
2712
+ bool result;
2713
+ VALUE vresult = Qnil;
2714
+
2715
+ if ((argc < 1) || (argc > 1)) {
2716
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2717
+ }
2718
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2719
+ if (!SWIG_IsOK(res1)) {
2720
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","addEdge", 1, self ));
2721
+ }
2722
+ arg1 = reinterpret_cast< Event * >(argp1);
2723
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2724
+ if (!SWIG_IsOK(res2)) {
2725
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "oboe_metadata_t *","addEdge", 2, argv[0] ));
2726
+ }
2727
+ arg2 = reinterpret_cast< oboe_metadata_t * >(argp2);
2728
+ result = (bool)(arg1)->addEdge(arg2);
2729
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2730
+ return vresult;
2731
+ fail:
2732
+ return Qnil;
2733
+ }
2734
+
2735
+
2736
+ SWIGINTERN VALUE
2737
+ _wrap_Event_getMetadata(int argc, VALUE *argv, VALUE self) {
2738
+ Event *arg1 = (Event *) 0 ;
2739
+ void *argp1 = 0 ;
2740
+ int res1 = 0 ;
2741
+ Metadata *result = 0 ;
2742
+ VALUE vresult = Qnil;
2743
+
2744
+ if ((argc < 0) || (argc > 0)) {
2745
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2746
+ }
2747
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2748
+ if (!SWIG_IsOK(res1)) {
2749
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","getMetadata", 1, self ));
2750
+ }
2751
+ arg1 = reinterpret_cast< Event * >(argp1);
2752
+ result = (Metadata *)(arg1)->getMetadata();
2753
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Metadata, SWIG_POINTER_OWN | 0 );
2754
+ return vresult;
2755
+ fail:
2756
+ return Qnil;
2757
+ }
2758
+
2759
+
2760
+ SWIGINTERN VALUE
2761
+ _wrap_Event_metadataString(int argc, VALUE *argv, VALUE self) {
2762
+ Event *arg1 = (Event *) 0 ;
2763
+ void *argp1 = 0 ;
2764
+ int res1 = 0 ;
2765
+ std::string result;
2766
+ VALUE vresult = Qnil;
2767
+
2768
+ if ((argc < 0) || (argc > 0)) {
2769
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2770
+ }
2771
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Event, 0 | 0 );
2772
+ if (!SWIG_IsOK(res1)) {
2773
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Event *","metadataString", 1, self ));
2774
+ }
2775
+ arg1 = reinterpret_cast< Event * >(argp1);
2776
+ result = (arg1)->metadataString();
2777
+ vresult = SWIG_From_std_string(static_cast< std::string >(result));
2778
+ return vresult;
2779
+ fail:
2780
+ return Qnil;
2781
+ }
2782
+
2783
+
2784
+ SWIGINTERN VALUE
2785
+ _wrap_Event_startTrace(int argc, VALUE *argv, VALUE self) {
2786
+ oboe_metadata_t *arg1 = (oboe_metadata_t *) 0 ;
2787
+ void *argp1 = 0 ;
2788
+ int res1 = 0 ;
2789
+ Event *result = 0 ;
2790
+ VALUE vresult = Qnil;
2791
+
2792
+ if ((argc < 1) || (argc > 1)) {
2793
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2794
+ }
2795
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2796
+ if (!SWIG_IsOK(res1)) {
2797
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "oboe_metadata_t const *","Event::startTrace", 1, argv[0] ));
2798
+ }
2799
+ arg1 = reinterpret_cast< oboe_metadata_t * >(argp1);
2800
+ result = (Event *)Event::startTrace((oboe_metadata_t const *)arg1);
2801
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | 0 );
2802
+ return vresult;
2803
+ fail:
2804
+ return Qnil;
2805
+ }
2806
+
2807
+
2808
+ static swig_class SwigClassUdpReporter;
2809
+
2810
+ SWIGINTERN VALUE
2811
+ _wrap_new_UdpReporter__SWIG_0(int argc, VALUE *argv, VALUE self) {
2812
+ char *arg1 = (char *) 0 ;
2813
+ char *arg2 = (char *) 0 ;
2814
+ int res1 ;
2815
+ char *buf1 = 0 ;
2816
+ int alloc1 = 0 ;
2817
+ int res2 ;
2818
+ char *buf2 = 0 ;
2819
+ int alloc2 = 0 ;
2820
+ UdpReporter *result = 0 ;
2821
+
2822
+ if ((argc < 2) || (argc > 2)) {
2823
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2824
+ }
2825
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2826
+ if (!SWIG_IsOK(res1)) {
2827
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","UdpReporter", 1, argv[0] ));
2828
+ }
2829
+ arg1 = reinterpret_cast< char * >(buf1);
2830
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2831
+ if (!SWIG_IsOK(res2)) {
2832
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","UdpReporter", 2, argv[1] ));
2833
+ }
2834
+ arg2 = reinterpret_cast< char * >(buf2);
2835
+ result = (UdpReporter *)new UdpReporter((char const *)arg1,(char const *)arg2);
2836
+ DATA_PTR(self) = result;
2837
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2838
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2839
+ return self;
2840
+ fail:
2841
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2842
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2843
+ return Qnil;
2844
+ }
2845
+
2846
+
2847
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2848
+ SWIGINTERN VALUE
2849
+ _wrap_UdpReporter_allocate(VALUE self) {
2850
+ #else
2851
+ SWIGINTERN VALUE
2852
+ _wrap_UdpReporter_allocate(int argc, VALUE *argv, VALUE self) {
2853
+ #endif
2854
+
2855
+
2856
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_UdpReporter);
2857
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2858
+ rb_obj_call_init(vresult, argc, argv);
2859
+ #endif
2860
+ return vresult;
2861
+ }
2862
+
2863
+
2864
+ SWIGINTERN VALUE
2865
+ _wrap_new_UdpReporter__SWIG_1(int argc, VALUE *argv, VALUE self) {
2866
+ char *arg1 = (char *) 0 ;
2867
+ int res1 ;
2868
+ char *buf1 = 0 ;
2869
+ int alloc1 = 0 ;
2870
+ UdpReporter *result = 0 ;
2871
+
2872
+ if ((argc < 1) || (argc > 1)) {
2873
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2874
+ }
2875
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2876
+ if (!SWIG_IsOK(res1)) {
2877
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","UdpReporter", 1, argv[0] ));
2878
+ }
2879
+ arg1 = reinterpret_cast< char * >(buf1);
2880
+ result = (UdpReporter *)new UdpReporter((char const *)arg1);
2881
+ DATA_PTR(self) = result;
2882
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2883
+ return self;
2884
+ fail:
2885
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2886
+ return Qnil;
2887
+ }
2888
+
2889
+
2890
+ SWIGINTERN VALUE _wrap_new_UdpReporter(int nargs, VALUE *args, VALUE self) {
2891
+ int argc;
2892
+ VALUE argv[2];
2893
+ int ii;
2894
+
2895
+ argc = nargs;
2896
+ if (argc > 2) SWIG_fail;
2897
+ for (ii = 0; (ii < argc); ++ii) {
2898
+ argv[ii] = args[ii];
2899
+ }
2900
+ if (argc == 1) {
2901
+ int _v;
2902
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2903
+ _v = SWIG_CheckState(res);
2904
+ if (_v) {
2905
+ return _wrap_new_UdpReporter__SWIG_1(nargs, args, self);
2906
+ }
2907
+ }
2908
+ if (argc == 2) {
2909
+ int _v;
2910
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2911
+ _v = SWIG_CheckState(res);
2912
+ if (_v) {
2913
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2914
+ _v = SWIG_CheckState(res);
2915
+ if (_v) {
2916
+ return _wrap_new_UdpReporter__SWIG_0(nargs, args, self);
2917
+ }
2918
+ }
2919
+ }
2920
+
2921
+ fail:
2922
+ Ruby_Format_OverloadedError( argc, 2, "UdpReporter.new",
2923
+ " UdpReporter.new(char const *addr, char const *port)\n"
2924
+ " UdpReporter.new(char const *addr)\n");
2925
+
2926
+ return Qnil;
2927
+ }
2928
+
2929
+
2930
+ SWIGINTERN void
2931
+ free_UdpReporter(UdpReporter *arg1) {
2932
+ delete arg1;
2933
+ }
2934
+
2935
+ SWIGINTERN VALUE
2936
+ _wrap_UdpReporter_sendReport__SWIG_0(int argc, VALUE *argv, VALUE self) {
2937
+ UdpReporter *arg1 = (UdpReporter *) 0 ;
2938
+ Event *arg2 = (Event *) 0 ;
2939
+ void *argp1 = 0 ;
2940
+ int res1 = 0 ;
2941
+ void *argp2 = 0 ;
2942
+ int res2 = 0 ;
2943
+ bool result;
2944
+ VALUE vresult = Qnil;
2945
+
2946
+ if ((argc < 1) || (argc > 1)) {
2947
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2948
+ }
2949
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_UdpReporter, 0 | 0 );
2950
+ if (!SWIG_IsOK(res1)) {
2951
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "UdpReporter *","sendReport", 1, self ));
2952
+ }
2953
+ arg1 = reinterpret_cast< UdpReporter * >(argp1);
2954
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Event, 0 | 0 );
2955
+ if (!SWIG_IsOK(res2)) {
2956
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Event *","sendReport", 2, argv[0] ));
2957
+ }
2958
+ arg2 = reinterpret_cast< Event * >(argp2);
2959
+ result = (bool)(arg1)->sendReport(arg2);
2960
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2961
+ return vresult;
2962
+ fail:
2963
+ return Qnil;
2964
+ }
2965
+
2966
+
2967
+ SWIGINTERN VALUE
2968
+ _wrap_UdpReporter_sendReport__SWIG_1(int argc, VALUE *argv, VALUE self) {
2969
+ UdpReporter *arg1 = (UdpReporter *) 0 ;
2970
+ Event *arg2 = (Event *) 0 ;
2971
+ oboe_metadata_t *arg3 = (oboe_metadata_t *) 0 ;
2972
+ void *argp1 = 0 ;
2973
+ int res1 = 0 ;
2974
+ void *argp2 = 0 ;
2975
+ int res2 = 0 ;
2976
+ void *argp3 = 0 ;
2977
+ int res3 = 0 ;
2978
+ bool result;
2979
+ VALUE vresult = Qnil;
2980
+
2981
+ if ((argc < 2) || (argc > 2)) {
2982
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2983
+ }
2984
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_UdpReporter, 0 | 0 );
2985
+ if (!SWIG_IsOK(res1)) {
2986
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "UdpReporter *","sendReport", 1, self ));
2987
+ }
2988
+ arg1 = reinterpret_cast< UdpReporter * >(argp1);
2989
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Event, 0 | 0 );
2990
+ if (!SWIG_IsOK(res2)) {
2991
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Event *","sendReport", 2, argv[0] ));
2992
+ }
2993
+ arg2 = reinterpret_cast< Event * >(argp2);
2994
+ res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2995
+ if (!SWIG_IsOK(res3)) {
2996
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "oboe_metadata_t *","sendReport", 3, argv[1] ));
2997
+ }
2998
+ arg3 = reinterpret_cast< oboe_metadata_t * >(argp3);
2999
+ result = (bool)(arg1)->sendReport(arg2,arg3);
3000
+ vresult = SWIG_From_bool(static_cast< bool >(result));
3001
+ return vresult;
3002
+ fail:
3003
+ return Qnil;
3004
+ }
3005
+
3006
+
3007
+ SWIGINTERN VALUE _wrap_UdpReporter_sendReport(int nargs, VALUE *args, VALUE self) {
3008
+ int argc;
3009
+ VALUE argv[4];
3010
+ int ii;
3011
+
3012
+ argc = nargs + 1;
3013
+ argv[0] = self;
3014
+ if (argc > 4) SWIG_fail;
3015
+ for (ii = 1; (ii < argc); ++ii) {
3016
+ argv[ii] = args[ii-1];
3017
+ }
3018
+ if (argc == 2) {
3019
+ int _v;
3020
+ void *vptr = 0;
3021
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_UdpReporter, 0);
3022
+ _v = SWIG_CheckState(res);
3023
+ if (_v) {
3024
+ void *vptr = 0;
3025
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Event, 0);
3026
+ _v = SWIG_CheckState(res);
3027
+ if (_v) {
3028
+ return _wrap_UdpReporter_sendReport__SWIG_0(nargs, args, self);
3029
+ }
3030
+ }
3031
+ }
3032
+ if (argc == 3) {
3033
+ int _v;
3034
+ void *vptr = 0;
3035
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_UdpReporter, 0);
3036
+ _v = SWIG_CheckState(res);
3037
+ if (_v) {
3038
+ void *vptr = 0;
3039
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Event, 0);
3040
+ _v = SWIG_CheckState(res);
3041
+ if (_v) {
3042
+ void *vptr = 0;
3043
+ int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_oboe_metadata_t, 0);
3044
+ _v = SWIG_CheckState(res);
3045
+ if (_v) {
3046
+ return _wrap_UdpReporter_sendReport__SWIG_1(nargs, args, self);
3047
+ }
3048
+ }
3049
+ }
3050
+ }
3051
+
3052
+ fail:
3053
+ Ruby_Format_OverloadedError( argc, 4, "UdpReporter.sendReport",
3054
+ " bool UdpReporter.sendReport(Event *evt)\n"
3055
+ " bool UdpReporter.sendReport(Event *evt, oboe_metadata_t *md)\n");
3056
+
3057
+ return Qnil;
3058
+ }
3059
+
3060
+
3061
+ static swig_class SwigClassFileReporter;
3062
+
3063
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
3064
+ SWIGINTERN VALUE
3065
+ _wrap_FileReporter_allocate(VALUE self) {
3066
+ #else
3067
+ SWIGINTERN VALUE
3068
+ _wrap_FileReporter_allocate(int argc, VALUE *argv, VALUE self) {
3069
+ #endif
3070
+
3071
+
3072
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_FileReporter);
3073
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
3074
+ rb_obj_call_init(vresult, argc, argv);
3075
+ #endif
3076
+ return vresult;
3077
+ }
3078
+
3079
+
3080
+ SWIGINTERN VALUE
3081
+ _wrap_new_FileReporter(int argc, VALUE *argv, VALUE self) {
3082
+ char *arg1 = (char *) 0 ;
3083
+ int res1 ;
3084
+ char *buf1 = 0 ;
3085
+ int alloc1 = 0 ;
3086
+ FileReporter *result = 0 ;
3087
+
3088
+ if ((argc < 1) || (argc > 1)) {
3089
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3090
+ }
3091
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3092
+ if (!SWIG_IsOK(res1)) {
3093
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","FileReporter", 1, argv[0] ));
3094
+ }
3095
+ arg1 = reinterpret_cast< char * >(buf1);
3096
+ result = (FileReporter *)new FileReporter((char const *)arg1);
3097
+ DATA_PTR(self) = result;
3098
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3099
+ return self;
3100
+ fail:
3101
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3102
+ return Qnil;
3103
+ }
3104
+
3105
+
3106
+ SWIGINTERN void
3107
+ free_FileReporter(FileReporter *arg1) {
3108
+ delete arg1;
3109
+ }
3110
+
3111
+ SWIGINTERN VALUE
3112
+ _wrap_FileReporter_sendReport__SWIG_0(int argc, VALUE *argv, VALUE self) {
3113
+ FileReporter *arg1 = (FileReporter *) 0 ;
3114
+ Event *arg2 = (Event *) 0 ;
3115
+ void *argp1 = 0 ;
3116
+ int res1 = 0 ;
3117
+ void *argp2 = 0 ;
3118
+ int res2 = 0 ;
3119
+ bool result;
3120
+ VALUE vresult = Qnil;
3121
+
3122
+ if ((argc < 1) || (argc > 1)) {
3123
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3124
+ }
3125
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FileReporter, 0 | 0 );
3126
+ if (!SWIG_IsOK(res1)) {
3127
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FileReporter *","sendReport", 1, self ));
3128
+ }
3129
+ arg1 = reinterpret_cast< FileReporter * >(argp1);
3130
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Event, 0 | 0 );
3131
+ if (!SWIG_IsOK(res2)) {
3132
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Event *","sendReport", 2, argv[0] ));
3133
+ }
3134
+ arg2 = reinterpret_cast< Event * >(argp2);
3135
+ result = (bool)(arg1)->sendReport(arg2);
3136
+ vresult = SWIG_From_bool(static_cast< bool >(result));
3137
+ return vresult;
3138
+ fail:
3139
+ return Qnil;
3140
+ }
3141
+
3142
+
3143
+ SWIGINTERN VALUE
3144
+ _wrap_FileReporter_sendReport__SWIG_1(int argc, VALUE *argv, VALUE self) {
3145
+ FileReporter *arg1 = (FileReporter *) 0 ;
3146
+ Event *arg2 = (Event *) 0 ;
3147
+ oboe_metadata_t *arg3 = (oboe_metadata_t *) 0 ;
3148
+ void *argp1 = 0 ;
3149
+ int res1 = 0 ;
3150
+ void *argp2 = 0 ;
3151
+ int res2 = 0 ;
3152
+ void *argp3 = 0 ;
3153
+ int res3 = 0 ;
3154
+ bool result;
3155
+ VALUE vresult = Qnil;
3156
+
3157
+ if ((argc < 2) || (argc > 2)) {
3158
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3159
+ }
3160
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FileReporter, 0 | 0 );
3161
+ if (!SWIG_IsOK(res1)) {
3162
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FileReporter *","sendReport", 1, self ));
3163
+ }
3164
+ arg1 = reinterpret_cast< FileReporter * >(argp1);
3165
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Event, 0 | 0 );
3166
+ if (!SWIG_IsOK(res2)) {
3167
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Event *","sendReport", 2, argv[0] ));
3168
+ }
3169
+ arg2 = reinterpret_cast< Event * >(argp2);
3170
+ res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
3171
+ if (!SWIG_IsOK(res3)) {
3172
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "oboe_metadata_t *","sendReport", 3, argv[1] ));
3173
+ }
3174
+ arg3 = reinterpret_cast< oboe_metadata_t * >(argp3);
3175
+ result = (bool)(arg1)->sendReport(arg2,arg3);
3176
+ vresult = SWIG_From_bool(static_cast< bool >(result));
3177
+ return vresult;
3178
+ fail:
3179
+ return Qnil;
3180
+ }
3181
+
3182
+
3183
+ SWIGINTERN VALUE _wrap_FileReporter_sendReport(int nargs, VALUE *args, VALUE self) {
3184
+ int argc;
3185
+ VALUE argv[4];
3186
+ int ii;
3187
+
3188
+ argc = nargs + 1;
3189
+ argv[0] = self;
3190
+ if (argc > 4) SWIG_fail;
3191
+ for (ii = 1; (ii < argc); ++ii) {
3192
+ argv[ii] = args[ii-1];
3193
+ }
3194
+ if (argc == 2) {
3195
+ int _v;
3196
+ void *vptr = 0;
3197
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FileReporter, 0);
3198
+ _v = SWIG_CheckState(res);
3199
+ if (_v) {
3200
+ void *vptr = 0;
3201
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Event, 0);
3202
+ _v = SWIG_CheckState(res);
3203
+ if (_v) {
3204
+ return _wrap_FileReporter_sendReport__SWIG_0(nargs, args, self);
3205
+ }
3206
+ }
3207
+ }
3208
+ if (argc == 3) {
3209
+ int _v;
3210
+ void *vptr = 0;
3211
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FileReporter, 0);
3212
+ _v = SWIG_CheckState(res);
3213
+ if (_v) {
3214
+ void *vptr = 0;
3215
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Event, 0);
3216
+ _v = SWIG_CheckState(res);
3217
+ if (_v) {
3218
+ void *vptr = 0;
3219
+ int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_oboe_metadata_t, 0);
3220
+ _v = SWIG_CheckState(res);
3221
+ if (_v) {
3222
+ return _wrap_FileReporter_sendReport__SWIG_1(nargs, args, self);
3223
+ }
3224
+ }
3225
+ }
3226
+ }
3227
+
3228
+ fail:
3229
+ Ruby_Format_OverloadedError( argc, 4, "FileReporter.sendReport",
3230
+ " bool FileReporter.sendReport(Event *evt)\n"
3231
+ " bool FileReporter.sendReport(Event *evt, oboe_metadata_t *md)\n");
3232
+
3233
+ return Qnil;
3234
+ }
3235
+
3236
+
3237
+
3238
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3239
+
3240
+ static void *_p_MetadataTo_p_oboe_metadata_t(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3241
+ return (void *)((oboe_metadata_t *) ((Metadata *) x));
3242
+ }
3243
+ static swig_type_info _swigt__p_Context = {"_p_Context", "Context *", 0, 0, (void*)0, 0};
3244
+ static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
3245
+ static swig_type_info _swigt__p_FileReporter = {"_p_FileReporter", "FileReporter *", 0, 0, (void*)0, 0};
3246
+ static swig_type_info _swigt__p_Metadata = {"_p_Metadata", "Metadata *", 0, 0, (void*)0, 0};
3247
+ static swig_type_info _swigt__p_UdpReporter = {"_p_UdpReporter", "UdpReporter *", 0, 0, (void*)0, 0};
3248
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3249
+ static swig_type_info _swigt__p_oboe_metadata_t = {"_p_oboe_metadata_t", "oboe_metadata_t *", 0, 0, (void*)0, 0};
3250
+
3251
+ static swig_type_info *swig_type_initial[] = {
3252
+ &_swigt__p_Context,
3253
+ &_swigt__p_Event,
3254
+ &_swigt__p_FileReporter,
3255
+ &_swigt__p_Metadata,
3256
+ &_swigt__p_UdpReporter,
3257
+ &_swigt__p_char,
3258
+ &_swigt__p_oboe_metadata_t,
3259
+ };
3260
+
3261
+ static swig_cast_info _swigc__p_Context[] = { {&_swigt__p_Context, 0, 0, 0},{0, 0, 0, 0}};
3262
+ static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
3263
+ static swig_cast_info _swigc__p_FileReporter[] = { {&_swigt__p_FileReporter, 0, 0, 0},{0, 0, 0, 0}};
3264
+ static swig_cast_info _swigc__p_Metadata[] = { {&_swigt__p_Metadata, 0, 0, 0},{0, 0, 0, 0}};
3265
+ static swig_cast_info _swigc__p_UdpReporter[] = { {&_swigt__p_UdpReporter, 0, 0, 0},{0, 0, 0, 0}};
3266
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3267
+ static swig_cast_info _swigc__p_oboe_metadata_t[] = { {&_swigt__p_Metadata, _p_MetadataTo_p_oboe_metadata_t, 0, 0}, {&_swigt__p_oboe_metadata_t, 0, 0, 0},{0, 0, 0, 0}};
3268
+
3269
+ static swig_cast_info *swig_cast_initial[] = {
3270
+ _swigc__p_Context,
3271
+ _swigc__p_Event,
3272
+ _swigc__p_FileReporter,
3273
+ _swigc__p_Metadata,
3274
+ _swigc__p_UdpReporter,
3275
+ _swigc__p_char,
3276
+ _swigc__p_oboe_metadata_t,
3277
+ };
3278
+
3279
+
3280
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3281
+
3282
+ /* -----------------------------------------------------------------------------
3283
+ * Type initialization:
3284
+ * This problem is tough by the requirement that no dynamic
3285
+ * memory is used. Also, since swig_type_info structures store pointers to
3286
+ * swig_cast_info structures and swig_cast_info structures store pointers back
3287
+ * to swig_type_info structures, we need some lookup code at initialization.
3288
+ * The idea is that swig generates all the structures that are needed.
3289
+ * The runtime then collects these partially filled structures.
3290
+ * The SWIG_InitializeModule function takes these initial arrays out of
3291
+ * swig_module, and does all the lookup, filling in the swig_module.types
3292
+ * array with the correct data and linking the correct swig_cast_info
3293
+ * structures together.
3294
+ *
3295
+ * The generated swig_type_info structures are assigned staticly to an initial
3296
+ * array. We just loop through that array, and handle each type individually.
3297
+ * First we lookup if this type has been already loaded, and if so, use the
3298
+ * loaded structure instead of the generated one. Then we have to fill in the
3299
+ * cast linked list. The cast data is initially stored in something like a
3300
+ * two-dimensional array. Each row corresponds to a type (there are the same
3301
+ * number of rows as there are in the swig_type_initial array). Each entry in
3302
+ * a column is one of the swig_cast_info structures for that type.
3303
+ * The cast_initial array is actually an array of arrays, because each row has
3304
+ * a variable number of columns. So to actually build the cast linked list,
3305
+ * we find the array of casts associated with the type, and loop through it
3306
+ * adding the casts to the list. The one last trick we need to do is making
3307
+ * sure the type pointer in the swig_cast_info struct is correct.
3308
+ *
3309
+ * First off, we lookup the cast->type name to see if it is already loaded.
3310
+ * There are three cases to handle:
3311
+ * 1) If the cast->type has already been loaded AND the type we are adding
3312
+ * casting info to has not been loaded (it is in this module), THEN we
3313
+ * replace the cast->type pointer with the type pointer that has already
3314
+ * been loaded.
3315
+ * 2) If BOTH types (the one we are adding casting info to, and the
3316
+ * cast->type) are loaded, THEN the cast info has already been loaded by
3317
+ * the previous module so we just ignore it.
3318
+ * 3) Finally, if cast->type has not already been loaded, then we add that
3319
+ * swig_cast_info to the linked list (because the cast->type) pointer will
3320
+ * be correct.
3321
+ * ----------------------------------------------------------------------------- */
3322
+
3323
+ #ifdef __cplusplus
3324
+ extern "C" {
3325
+ #if 0
3326
+ } /* c-mode */
3327
+ #endif
3328
+ #endif
3329
+
3330
+ #if 0
3331
+ #define SWIGRUNTIME_DEBUG
3332
+ #endif
3333
+
3334
+
3335
+ SWIGRUNTIME void
3336
+ SWIG_InitializeModule(void *clientdata) {
3337
+ size_t i;
3338
+ swig_module_info *module_head, *iter;
3339
+ int found, init;
3340
+ (void *)clientdata;
3341
+
3342
+ /* check to see if the circular list has been setup, if not, set it up */
3343
+ if (swig_module.next==0) {
3344
+ /* Initialize the swig_module */
3345
+ swig_module.type_initial = swig_type_initial;
3346
+ swig_module.cast_initial = swig_cast_initial;
3347
+ swig_module.next = &swig_module;
3348
+ init = 1;
3349
+ } else {
3350
+ init = 0;
3351
+ }
3352
+
3353
+ /* Try and load any already created modules */
3354
+ module_head = SWIG_GetModule(clientdata);
3355
+ if (!module_head) {
3356
+ /* This is the first module loaded for this interpreter */
3357
+ /* so set the swig module into the interpreter */
3358
+ SWIG_SetModule(clientdata, &swig_module);
3359
+ module_head = &swig_module;
3360
+ } else {
3361
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3362
+ found=0;
3363
+ iter=module_head;
3364
+ do {
3365
+ if (iter==&swig_module) {
3366
+ found=1;
3367
+ break;
3368
+ }
3369
+ iter=iter->next;
3370
+ } while (iter!= module_head);
3371
+
3372
+ /* if the is found in the list, then all is done and we may leave */
3373
+ if (found) return;
3374
+ /* otherwise we must add out module into the list */
3375
+ swig_module.next = module_head->next;
3376
+ module_head->next = &swig_module;
3377
+ }
3378
+
3379
+ /* When multiple interpeters are used, a module could have already been initialized in
3380
+ a different interpreter, but not yet have a pointer in this interpreter.
3381
+ In this case, we do not want to continue adding types... everything should be
3382
+ set up already */
3383
+ if (init == 0) return;
3384
+
3385
+ /* Now work on filling in swig_module.types */
3386
+ #ifdef SWIGRUNTIME_DEBUG
3387
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3388
+ #endif
3389
+ for (i = 0; i < swig_module.size; ++i) {
3390
+ swig_type_info *type = 0;
3391
+ swig_type_info *ret;
3392
+ swig_cast_info *cast;
3393
+
3394
+ #ifdef SWIGRUNTIME_DEBUG
3395
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3396
+ #endif
3397
+
3398
+ /* if there is another module already loaded */
3399
+ if (swig_module.next != &swig_module) {
3400
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3401
+ }
3402
+ if (type) {
3403
+ /* Overwrite clientdata field */
3404
+ #ifdef SWIGRUNTIME_DEBUG
3405
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
3406
+ #endif
3407
+ if (swig_module.type_initial[i]->clientdata) {
3408
+ type->clientdata = swig_module.type_initial[i]->clientdata;
3409
+ #ifdef SWIGRUNTIME_DEBUG
3410
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3411
+ #endif
3412
+ }
3413
+ } else {
3414
+ type = swig_module.type_initial[i];
3415
+ }
3416
+
3417
+ /* Insert casting types */
3418
+ cast = swig_module.cast_initial[i];
3419
+ while (cast->type) {
3420
+
3421
+ /* Don't need to add information already in the list */
3422
+ ret = 0;
3423
+ #ifdef SWIGRUNTIME_DEBUG
3424
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3425
+ #endif
3426
+ if (swig_module.next != &swig_module) {
3427
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3428
+ #ifdef SWIGRUNTIME_DEBUG
3429
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3430
+ #endif
3431
+ }
3432
+ if (ret) {
3433
+ if (type == swig_module.type_initial[i]) {
3434
+ #ifdef SWIGRUNTIME_DEBUG
3435
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3436
+ #endif
3437
+ cast->type = ret;
3438
+ ret = 0;
3439
+ } else {
3440
+ /* Check for casting already in the list */
3441
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3442
+ #ifdef SWIGRUNTIME_DEBUG
3443
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3444
+ #endif
3445
+ if (!ocast) ret = 0;
3446
+ }
3447
+ }
3448
+
3449
+ if (!ret) {
3450
+ #ifdef SWIGRUNTIME_DEBUG
3451
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3452
+ #endif
3453
+ if (type->cast) {
3454
+ type->cast->prev = cast;
3455
+ cast->next = type->cast;
3456
+ }
3457
+ type->cast = cast;
3458
+ }
3459
+ cast++;
3460
+ }
3461
+ /* Set entry in modules->types array equal to the type */
3462
+ swig_module.types[i] = type;
3463
+ }
3464
+ swig_module.types[i] = 0;
3465
+
3466
+ #ifdef SWIGRUNTIME_DEBUG
3467
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
3468
+ for (i = 0; i < swig_module.size; ++i) {
3469
+ int j = 0;
3470
+ swig_cast_info *cast = swig_module.cast_initial[i];
3471
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3472
+ while (cast->type) {
3473
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3474
+ cast++;
3475
+ ++j;
3476
+ }
3477
+ printf("---- Total casts: %d\n",j);
3478
+ }
3479
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
3480
+ #endif
3481
+ }
3482
+
3483
+ /* This function will propagate the clientdata field of type to
3484
+ * any new swig_type_info structures that have been added into the list
3485
+ * of equivalent types. It is like calling
3486
+ * SWIG_TypeClientData(type, clientdata) a second time.
3487
+ */
3488
+ SWIGRUNTIME void
3489
+ SWIG_PropagateClientData(void) {
3490
+ size_t i;
3491
+ swig_cast_info *equiv;
3492
+ static int init_run = 0;
3493
+
3494
+ if (init_run) return;
3495
+ init_run = 1;
3496
+
3497
+ for (i = 0; i < swig_module.size; i++) {
3498
+ if (swig_module.types[i]->clientdata) {
3499
+ equiv = swig_module.types[i]->cast;
3500
+ while (equiv) {
3501
+ if (!equiv->converter) {
3502
+ if (equiv->type && !equiv->type->clientdata)
3503
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3504
+ }
3505
+ equiv = equiv->next;
3506
+ }
3507
+ }
3508
+ }
3509
+ }
3510
+
3511
+ #ifdef __cplusplus
3512
+ #if 0
3513
+ { /* c-mode */
3514
+ #endif
3515
+ }
3516
+ #endif
3517
+
3518
+ /*
3519
+
3520
+ */
3521
+ #ifdef __cplusplus
3522
+ extern "C"
3523
+ #endif
3524
+ SWIGEXPORT void Init_oboe_metal(void) {
3525
+ size_t i;
3526
+
3527
+ SWIG_InitRuntime();
3528
+ mOboe_metal = rb_define_module("Oboe_metal");
3529
+
3530
+ SWIG_InitializeModule(0);
3531
+ for (i = 0; i < swig_module.size; i++) {
3532
+ SWIG_define_class(swig_module.types[i]);
3533
+ }
3534
+
3535
+ SWIG_RubyInitializeTrackings();
3536
+
3537
+ SwigClassMetadata.klass = rb_define_class_under(mOboe_metal, "Metadata", rb_cObject);
3538
+ SWIG_TypeClientData(SWIGTYPE_p_Metadata, (void *) &SwigClassMetadata);
3539
+ rb_define_alloc_func(SwigClassMetadata.klass, _wrap_Metadata_allocate);
3540
+ rb_define_method(SwigClassMetadata.klass, "initialize", VALUEFUNC(_wrap_new_Metadata), -1);
3541
+ rb_define_singleton_method(SwigClassMetadata.klass, "fromString", VALUEFUNC(_wrap_Metadata_fromString), -1);
3542
+ rb_define_method(SwigClassMetadata.klass, "createEvent", VALUEFUNC(_wrap_Metadata_createEvent), -1);
3543
+ rb_define_singleton_method(SwigClassMetadata.klass, "makeRandom", VALUEFUNC(_wrap_Metadata_makeRandom), -1);
3544
+ rb_define_method(SwigClassMetadata.klass, "copy", VALUEFUNC(_wrap_Metadata_copy), -1);
3545
+ rb_define_method(SwigClassMetadata.klass, "isValid", VALUEFUNC(_wrap_Metadata_isValid), -1);
3546
+ rb_define_method(SwigClassMetadata.klass, "toString", VALUEFUNC(_wrap_Metadata_toString), -1);
3547
+ SwigClassMetadata.mark = 0;
3548
+ SwigClassMetadata.destroy = (void (*)(void *)) free_Metadata;
3549
+ SwigClassMetadata.trackObjects = 0;
3550
+
3551
+ SwigClassContext.klass = rb_define_class_under(mOboe_metal, "Context", rb_cObject);
3552
+ SWIG_TypeClientData(SWIGTYPE_p_Context, (void *) &SwigClassContext);
3553
+ rb_define_alloc_func(SwigClassContext.klass, _wrap_Context_allocate);
3554
+ rb_define_method(SwigClassContext.klass, "initialize", VALUEFUNC(_wrap_new_Context), -1);
3555
+ rb_define_singleton_method(SwigClassContext.klass, "get", VALUEFUNC(_wrap_Context_get), -1);
3556
+ rb_define_singleton_method(SwigClassContext.klass, "toString", VALUEFUNC(_wrap_Context_toString), -1);
3557
+ rb_define_singleton_method(SwigClassContext.klass, "set", VALUEFUNC(_wrap_Context_set), -1);
3558
+ rb_define_singleton_method(SwigClassContext.klass, "fromString", VALUEFUNC(_wrap_Context_fromString), -1);
3559
+ rb_define_singleton_method(SwigClassContext.klass, "copy", VALUEFUNC(_wrap_Context_copy), -1);
3560
+ rb_define_singleton_method(SwigClassContext.klass, "clear", VALUEFUNC(_wrap_Context_clear), -1);
3561
+ rb_define_singleton_method(SwigClassContext.klass, "isValid", VALUEFUNC(_wrap_Context_isValid), -1);
3562
+ rb_define_singleton_method(SwigClassContext.klass, "init", VALUEFUNC(_wrap_Context_init), -1);
3563
+ rb_define_singleton_method(SwigClassContext.klass, "createEvent", VALUEFUNC(_wrap_Context_createEvent), -1);
3564
+ rb_define_singleton_method(SwigClassContext.klass, "startTrace", VALUEFUNC(_wrap_Context_startTrace), -1);
3565
+ SwigClassContext.mark = 0;
3566
+ SwigClassContext.destroy = (void (*)(void *)) free_Context;
3567
+ SwigClassContext.trackObjects = 0;
3568
+
3569
+ SwigClassEvent.klass = rb_define_class_under(mOboe_metal, "Event", rb_cObject);
3570
+ SWIG_TypeClientData(SWIGTYPE_p_Event, (void *) &SwigClassEvent);
3571
+ rb_undef_alloc_func(SwigClassEvent.klass);
3572
+ rb_define_method(SwigClassEvent.klass, "addInfo", VALUEFUNC(_wrap_Event_addInfo), -1);
3573
+ rb_define_method(SwigClassEvent.klass, "addEdge", VALUEFUNC(_wrap_Event_addEdge), -1);
3574
+ rb_define_method(SwigClassEvent.klass, "getMetadata", VALUEFUNC(_wrap_Event_getMetadata), -1);
3575
+ rb_define_method(SwigClassEvent.klass, "metadataString", VALUEFUNC(_wrap_Event_metadataString), -1);
3576
+ rb_define_singleton_method(SwigClassEvent.klass, "startTrace", VALUEFUNC(_wrap_Event_startTrace), -1);
3577
+ SwigClassEvent.mark = 0;
3578
+ SwigClassEvent.destroy = (void (*)(void *)) free_Event;
3579
+ SwigClassEvent.trackObjects = 0;
3580
+
3581
+ SwigClassUdpReporter.klass = rb_define_class_under(mOboe_metal, "UdpReporter", rb_cObject);
3582
+ SWIG_TypeClientData(SWIGTYPE_p_UdpReporter, (void *) &SwigClassUdpReporter);
3583
+ rb_define_alloc_func(SwigClassUdpReporter.klass, _wrap_UdpReporter_allocate);
3584
+ rb_define_method(SwigClassUdpReporter.klass, "initialize", VALUEFUNC(_wrap_new_UdpReporter), -1);
3585
+ rb_define_method(SwigClassUdpReporter.klass, "sendReport", VALUEFUNC(_wrap_UdpReporter_sendReport), -1);
3586
+ SwigClassUdpReporter.mark = 0;
3587
+ SwigClassUdpReporter.destroy = (void (*)(void *)) free_UdpReporter;
3588
+ SwigClassUdpReporter.trackObjects = 0;
3589
+
3590
+ SwigClassFileReporter.klass = rb_define_class_under(mOboe_metal, "FileReporter", rb_cObject);
3591
+ SWIG_TypeClientData(SWIGTYPE_p_FileReporter, (void *) &SwigClassFileReporter);
3592
+ rb_define_alloc_func(SwigClassFileReporter.klass, _wrap_FileReporter_allocate);
3593
+ rb_define_method(SwigClassFileReporter.klass, "initialize", VALUEFUNC(_wrap_new_FileReporter), -1);
3594
+ rb_define_method(SwigClassFileReporter.klass, "sendReport", VALUEFUNC(_wrap_FileReporter_sendReport), -1);
3595
+ SwigClassFileReporter.mark = 0;
3596
+ SwigClassFileReporter.destroy = (void (*)(void *)) free_FileReporter;
3597
+ SwigClassFileReporter.trackObjects = 0;
3598
+ }
3599
+