~ubuntu-branches/ubuntu/raring/babel/raring-proposed

« back to all changes in this revision

Viewing changes to runtime/python/sidl/sidl_BaseClass_Module.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2008-08-01 07:56:58 UTC
  • mfrom: (3.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080801075658-9ezcrbh8dcs8lg70
Tags: 1.2.0.dfsg-6
Added libparsifal-dev as dependency to libsidl-dev (closes: #483324).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * File:          sidl_BaseClass_Module.c
 
3
 * Symbol:        sidl.BaseClass-v0.9.17
 
4
 * Symbol Type:   class
 
5
 * Babel Version: 1.2.0
 
6
 * Release:       $Name:  $
 
7
 * Revision:      @(#) $Id: $
 
8
 * Description:   implement a C extension type for a sidl extendable
 
9
 * 
 
10
 * Copyright (c) 2000-2002, Lawrence Livermore National Security, LLC.
 
11
 * Produced at the Lawrence Livermore National Laboratory.
 
12
 * Written by the Components Team <components@llnl.gov>
 
13
 * All rights reserved.
 
14
 * 
 
15
 * This file is part of Babel. For more information, see
 
16
 * http://www.llnl.gov/CASC/components/. Please read the COPYRIGHT file
 
17
 * for Our Notice and the LICENSE file for the GNU Lesser General Public
 
18
 * License.
 
19
 * 
 
20
 * This program is free software; you can redistribute it and/or modify it
 
21
 * under the terms of the GNU Lesser General Public License (as published by
 
22
 * the Free Software Foundation) version 2.1 dated February 1999.
 
23
 * 
 
24
 * This program is distributed in the hope that it will be useful, but
 
25
 * WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
 
26
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
 
27
 * conditions of the GNU Lesser General Public License for more details.
 
28
 * 
 
29
 * You should have recieved a copy of the GNU Lesser General Public License
 
30
 * along with this program; if not, write to the Free Software Foundation,
 
31
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
32
 * 
 
33
 * WARNING: Automatically generated; changes will be lost
 
34
 * 
 
35
 */
 
36
 
 
37
/*
 
38
 * THIS CODE IS AUTOMATICALLY GENERATED BY THE BABEL
 
39
 * COMPILER. DO NOT EDIT THIS!
 
40
 * 
 
41
 * This file contains the implementation of a Python C
 
42
 * extension type (i.e. a Python type implemented in C).
 
43
 * This extension type provides Python interface to the
 
44
 * sidl type sidl.BaseClass.
 
45
 */
 
46
 
 
47
 
 
48
/**
 
49
 * Symbol "sidl.BaseClass" (version 0.9.17)
 
50
 * 
 
51
 * Every class implicitly inherits from <code>BaseClass</code>.  This
 
52
 * class implements the methods in <code>BaseInterface</code>.
 
53
 */
 
54
#include <Python.h>
 
55
#include <stdlib.h>
 
56
#include <string.h>
 
57
#include <stdio.h>
 
58
#ifndef included_sidl_BaseClass_h
 
59
#include "sidl_BaseClass.h"
 
60
#endif
 
61
#ifndef included_sidl_ClassInfo_h
 
62
#include "sidl_ClassInfo.h"
 
63
#endif
 
64
#ifndef included_sidl_rmi_ProtocolFactory_h
 
65
#include "sidl_rmi_ProtocolFactory.h"
 
66
#endif
 
67
#ifndef included_sidl_rmi_InstanceRegistry_h
 
68
#include "sidl_rmi_InstanceRegistry.h"
 
69
#endif
 
70
#ifndef included_sidl_rmi_InstanceHandle_h
 
71
#include "sidl_rmi_InstanceHandle.h"
 
72
#endif
 
73
#ifndef included_sidl_rmi_Invocation_h
 
74
#include "sidl_rmi_Invocation.h"
 
75
#endif
 
76
#ifndef included_sidl_rmi_Response_h
 
77
#include "sidl_rmi_Response.h"
 
78
#endif
 
79
#ifndef included_sidl_rmi_ServerRegistry_h
 
80
#include "sidl_rmi_ServerRegistry.h"
 
81
#endif
 
82
#ifndef included_sidl_rmi_ConnectRegistry_h
 
83
#include "sidl_rmi_ConnectRegistry.h"
 
84
#endif
 
85
#ifndef included_sidl_io_Serializable_h
 
86
#include "sidl_io_Serializable.h"
 
87
#endif
 
88
#ifndef included_sidl_MemAllocException_h
 
89
#include "sidl_MemAllocException.h"
 
90
#endif
 
91
#ifndef included_sidl_NotImplementedException_h
 
92
#include "sidl_NotImplementedException.h"
 
93
#endif
 
94
#include "sidl_Exception.h"
 
95
 
 
96
#ifndef NULL
 
97
#define NULL 0
 
98
#endif
 
99
 
 
100
#include "sidl_thread.h"
 
101
#ifdef HAVE_PTHREAD
 
102
static struct sidl_recursive_mutex_t sidl_BaseClass__mutex= SIDL_RECURSIVE_MUTEX_INITIALIZER;
 
103
#define LOCK_STATIC_GLOBALS sidl_recursive_mutex_lock( &sidl_BaseClass__mutex )
 
104
#define UNLOCK_STATIC_GLOBALS sidl_recursive_mutex_unlock( &sidl_BaseClass__mutex )
 
105
/* #define HAVE_LOCKED_STATIC_GLOBALS (sidl_recursive_mutex_trylock( &sidl_BaseClass__mutex )==EDEADLOCK) */
 
106
#else
 
107
#define LOCK_STATIC_GLOBALS
 
108
#define UNLOCK_STATIC_GLOBALS
 
109
/* #define HAVE_LOCKED_STATIC_GLOBALS (1) */
 
110
#endif
 
111
 
 
112
#define sidl_BaseClass_INTERNAL 1
 
113
#include "sidl_BaseClass_Module.h"
 
114
#ifndef included_sidl_BaseClass_IOR_h
 
115
#include "sidl_BaseClass_IOR.h"
 
116
#endif
 
117
#include "sidlObjA.h"
 
118
#include "sidlPyArrays.h"
 
119
#ifdef SIDL_HAVE_NUMPY
 
120
#include "oldnumeric.h"
 
121
#elif defined(SIDL_HAVE_NUMERIC_PYTHON)
 
122
#include "Numeric/arrayobject.h"
 
123
#else
 
124
#error Neither Numeric Python nor NumPy installed
 
125
#endif
 
126
#ifndef included_sidl_Loader_h
 
127
#include "sidl_Loader.h"
 
128
#endif
 
129
#ifndef included_sidl_header_h
 
130
#include "sidl_header.h"
 
131
#endif
 
132
#ifndef included_sidl_interface_IOR_h
 
133
#include "sidl_interface_IOR.h"
 
134
#endif
 
135
#include "sidl_rmi_NetworkException_Module.h"
 
136
#include "sidl_BaseInterface_Module.h"
 
137
#include "sidl_ClassInfo_Module.h"
 
138
#include "sidl_RuntimeException_Module.h"
 
139
#include "sidl_rmi_Call_Module.h"
 
140
#include "sidl_rmi_Return_Module.h"
 
141
#include "sidl_rmi_Ticket_Module.h"
 
142
#include <stdlib.h>
 
143
#include <string.h>
 
144
#include <stddef.h>
 
145
#include <stdio.h>
 
146
 
 
147
/*
 
148
 * lang_inited is a boolean value showing if we have already imported all the nescessary modules
 
149
 */
 
150
 
 
151
static int lang_inited = 0;
 
152
 
 
153
#define LANG_SPECIFIC_INIT() if(!lang_inited) { \
 
154
  lang_inited = 1; \
 
155
  sidl_BaseClass__import(); \
 
156
  sidl_BaseInterface__import(); \
 
157
  sidl_ClassInfo__import(); \
 
158
  sidl_RuntimeException__import(); \
 
159
  sidl_rmi_Ticket__import(); \
 
160
}
 
161
 
 
162
#ifdef WITH_RMI
 
163
 
 
164
/**
 
165
 * RMI connector function for the class. (no addref)
 
166
 */
 
167
struct sidl_BaseClass__object*
 
168
sidl_BaseClass__connectI(const char * url, sidl_bool ar, struct               \
 
169
  sidl_BaseInterface__object **_ex);
 
170
 
 
171
 
 
172
#endif /*WITH_RMI*/
 
173
 
 
174
/* Static variables to hold version of IOR */
 
175
static const int32_t s_IOR_MAJOR_VERSION = 2;
 
176
static const int32_t s_IOR_MINOR_VERSION = 0;
 
177
 
 
178
/* Static variables for managing EPV initialization. */
 
179
static int s_remote_initialized = 0;
 
180
 
 
181
static struct sidl_BaseClass__epv s_rem_epv__sidl_baseclass;
 
182
 
 
183
static struct sidl_BaseInterface__epv s_rem_epv__sidl_baseinterface;
 
184
 
 
185
#ifdef WITH_RMI
 
186
 
 
187
 
 
188
/* REMOTE CAST: dynamic type casting for remote objects. */
 
189
static void* remote_sidl_BaseClass__cast(
 
190
  struct sidl_BaseClass__object* self,
 
191
  const char* name, sidl_BaseInterface* _ex)
 
192
{
 
193
  int cmp;
 
194
  void* cast = NULL;
 
195
  *_ex = NULL; /* default to no exception */
 
196
  cmp = strcmp(name, "sidl.BaseInterface");
 
197
  if (!cmp) {
 
198
    (*self->d_epv->f_addRef)(self, _ex); SIDL_CHECK(*_ex);
 
199
    cast = &((*self).d_sidl_baseinterface);
 
200
    return cast;
 
201
  }
 
202
  else if (cmp < 0) {
 
203
    cmp = strcmp(name, "sidl.BaseClass");
 
204
    if (!cmp) {
 
205
      (*self->d_epv->f_addRef)(self, _ex); SIDL_CHECK(*_ex);
 
206
      cast = ((struct sidl_BaseClass__object*)self);
 
207
      return cast;
 
208
    }
 
209
  }
 
210
  if ((*self->d_epv->f_isType)(self,name, _ex)) {
 
211
    void* (*func)(struct sidl_rmi_InstanceHandle__object*, struct             \
 
212
      sidl_BaseInterface__object**) = 
 
213
      (void* (*)(struct sidl_rmi_InstanceHandle__object*, struct              \
 
214
        sidl_BaseInterface__object**)) 
 
215
      sidl_rmi_ConnectRegistry_getConnect(name, _ex);SIDL_CHECK(*_ex);
 
216
    cast =  (*func)(((struct sidl_BaseClass__remote*)self->d_data)->d_ih,     \
 
217
      _ex);
 
218
  }
 
219
 
 
220
  return cast;
 
221
  EXIT:
 
222
  return NULL;
 
223
}
 
224
 
 
225
/* REMOTE DELETE: call the remote destructor for the object. */
 
226
static void remote_sidl_BaseClass__delete(
 
227
  struct sidl_BaseClass__object* self,
 
228
  struct sidl_BaseInterface__object* *_ex)
 
229
{
 
230
  *_ex = NULL;
 
231
  free((void*) self);
 
232
}
 
233
 
 
234
/* REMOTE GETURL: call the getURL function for the object. */
 
235
static char* remote_sidl_BaseClass__getURL(
 
236
  struct sidl_BaseClass__object* self, struct sidl_BaseInterface__object*     \
 
237
    *_ex)
 
238
{
 
239
  struct sidl_rmi_InstanceHandle__object *conn = ((struct                     \
 
240
    sidl_BaseClass__remote*)self->d_data)->d_ih;
 
241
  *_ex = NULL;
 
242
  if(conn != NULL) {
 
243
    return sidl_rmi_InstanceHandle_getObjectURL(conn, _ex);
 
244
  }
 
245
  return NULL;
 
246
}
 
247
 
 
248
/* REMOTE ADDREF: For internal babel use only! Remote addRef. */
 
249
static void remote_sidl_BaseClass__raddRef(
 
250
  struct sidl_BaseClass__object* self,struct sidl_BaseInterface__object* *_ex)
 
251
{
 
252
  struct sidl_BaseException__object* netex = NULL;
 
253
  /* initialize a new invocation */
 
254
  struct sidl_BaseInterface__object* _throwaway = NULL;
 
255
  struct sidl_rmi_InstanceHandle__object *_conn = ((struct                    \
 
256
    sidl_BaseClass__remote*)self->d_data)->d_ih;
 
257
  sidl_rmi_Response _rsvp = NULL;
 
258
  sidl_rmi_Invocation _inv = sidl_rmi_InstanceHandle_createInvocation( _conn, \
 
259
    "addRef", _ex ); SIDL_CHECK(*_ex);
 
260
  /* send actual RMI request */
 
261
  _rsvp = sidl_rmi_Invocation_invokeMethod(_inv,_ex);SIDL_CHECK(*_ex);
 
262
  /* Check for exceptions */
 
263
  netex = sidl_rmi_Response_getExceptionThrown(_rsvp, _ex);
 
264
  if(netex != NULL) {
 
265
    *_ex = (struct sidl_BaseInterface__object*)netex;
 
266
    return;
 
267
  }
 
268
 
 
269
  /* cleanup and return */
 
270
  EXIT:
 
271
  if(_inv) { sidl_rmi_Invocation_deleteRef(_inv,&_throwaway); }
 
272
  if(_rsvp) { sidl_rmi_Response_deleteRef(_rsvp,&_throwaway); }
 
273
  return;
 
274
}
 
275
 
 
276
/* REMOTE ISREMOTE: returns true if this object is Remote (it is). */
 
277
static sidl_bool
 
278
remote_sidl_BaseClass__isRemote(
 
279
    struct sidl_BaseClass__object* self, 
 
280
    struct sidl_BaseInterface__object* *_ex) {
 
281
  *_ex = NULL;
 
282
  return TRUE;
 
283
}
 
284
 
 
285
/* REMOTE METHOD STUB:_set_hooks */
 
286
static void
 
287
remote_sidl_BaseClass__set_hooks(
 
288
  /* in */ struct sidl_BaseClass__object *self ,
 
289
  /* in */ sidl_bool on,
 
290
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
291
{
 
292
  LANG_SPECIFIC_INIT();
 
293
  *_ex = NULL;
 
294
  {
 
295
    /* initialize a new invocation */
 
296
    struct sidl_BaseInterface__object* _throwaway = NULL;
 
297
    sidl_BaseException _be = NULL;
 
298
    sidl_rmi_Response _rsvp = NULL;
 
299
    struct sidl_rmi_InstanceHandle__object * _conn = ((struct                 \
 
300
      sidl_BaseClass__remote*)self->d_data)->d_ih;
 
301
    sidl_rmi_Invocation _inv = sidl_rmi_InstanceHandle_createInvocation(      \
 
302
      _conn, "_set_hooks", _ex ); SIDL_CHECK(*_ex);
 
303
 
 
304
    /* pack in and inout arguments */
 
305
    sidl_rmi_Invocation_packBool( _inv, "on", on, _ex);SIDL_CHECK(*_ex);
 
306
 
 
307
    /* send actual RMI request */
 
308
    _rsvp = sidl_rmi_Invocation_invokeMethod(_inv, _ex);SIDL_CHECK(*_ex);
 
309
 
 
310
    _be = sidl_rmi_Response_getExceptionThrown(_rsvp, _ex);SIDL_CHECK(*_ex);
 
311
    if(_be != NULL) {
 
312
      struct sidl_BaseInterface__object* throwaway_exception = NULL;
 
313
sidl_BaseException_addLine(_be, "Exception unserialized from sidl.BaseClass._set_hooks.", &throwaway_exception);
 
314
      *_ex = (struct sidl_BaseInterface__object*) sidl_BaseInterface__cast(   \
 
315
        _be,&throwaway_exception);
 
316
      goto EXIT;
 
317
    }
 
318
 
 
319
    /* unpack out and inout arguments */
 
320
 
 
321
    /* cleanup and return */
 
322
    EXIT:
 
323
    if(_inv) { sidl_rmi_Invocation_deleteRef(_inv, &_throwaway); }
 
324
    if(_rsvp) { sidl_rmi_Response_deleteRef(_rsvp, &_throwaway); }
 
325
    return;
 
326
  }
 
327
}
 
328
 
 
329
/* REMOTE EXEC: call the exec function for the object. */
 
330
static void remote_sidl_BaseClass__exec(
 
331
  struct sidl_BaseClass__object* self,const char* methodName,
 
332
  sidl_rmi_Call inArgs,
 
333
  sidl_rmi_Return outArgs,
 
334
  struct sidl_BaseInterface__object* *_ex)
 
335
{
 
336
  *_ex = NULL;
 
337
}
 
338
 
 
339
/* REMOTE METHOD STUB:addRef */
 
340
static void
 
341
remote_sidl_BaseClass_addRef(
 
342
  /* in */ struct sidl_BaseClass__object *self ,
 
343
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
344
{
 
345
  LANG_SPECIFIC_INIT();
 
346
  *_ex = NULL;
 
347
  {
 
348
    struct sidl_BaseClass__remote* r_obj = (struct                            \
 
349
      sidl_BaseClass__remote*)self->d_data;
 
350
    LOCK_STATIC_GLOBALS;
 
351
    r_obj->d_refcount++;
 
352
#ifdef SIDL_DEBUG_REFCOUNT
 
353
    fprintf(stderr, "babel: addRef %p new count %d (type %s)\n",r_obj, r_obj->d_refcount, "sidl.BaseClass Remote Stub");
 
354
#endif /* SIDL_DEBUG_REFCOUNT */ 
 
355
    UNLOCK_STATIC_GLOBALS;
 
356
  }
 
357
}
 
358
 
 
359
/* REMOTE METHOD STUB:deleteRef */
 
360
static void
 
361
remote_sidl_BaseClass_deleteRef(
 
362
  /* in */ struct sidl_BaseClass__object *self ,
 
363
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
364
{
 
365
  LANG_SPECIFIC_INIT();
 
366
  *_ex = NULL;
 
367
  {
 
368
    struct sidl_BaseClass__remote* r_obj = (struct                            \
 
369
      sidl_BaseClass__remote*)self->d_data;
 
370
    LOCK_STATIC_GLOBALS;
 
371
    r_obj->d_refcount--;
 
372
#ifdef SIDL_DEBUG_REFCOUNT
 
373
    fprintf(stderr, "babel: deleteRef %p new count %d (type %s)\n",r_obj, r_obj->d_refcount, "sidl.BaseClass Remote Stub");
 
374
#endif /* SIDL_DEBUG_REFCOUNT */ 
 
375
    if(r_obj->d_refcount == 0) {
 
376
      sidl_rmi_InstanceHandle_deleteRef(r_obj->d_ih, _ex);
 
377
      free(r_obj);
 
378
      free(self);
 
379
    }
 
380
    UNLOCK_STATIC_GLOBALS;
 
381
  }
 
382
}
 
383
 
 
384
/* REMOTE METHOD STUB:isSame */
 
385
static sidl_bool
 
386
remote_sidl_BaseClass_isSame(
 
387
  /* in */ struct sidl_BaseClass__object *self ,
 
388
  /* in */ struct sidl_BaseInterface__object* iobj,
 
389
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
390
{
 
391
  LANG_SPECIFIC_INIT();
 
392
  *_ex = NULL;
 
393
  {
 
394
    /* initialize a new invocation */
 
395
    struct sidl_BaseInterface__object* _throwaway = NULL;
 
396
    sidl_BaseException _be = NULL;
 
397
    sidl_rmi_Response _rsvp = NULL;
 
398
    sidl_bool _retval = FALSE;
 
399
    struct sidl_rmi_InstanceHandle__object * _conn = ((struct                 \
 
400
      sidl_BaseClass__remote*)self->d_data)->d_ih;
 
401
    sidl_rmi_Invocation _inv = sidl_rmi_InstanceHandle_createInvocation(      \
 
402
      _conn, "isSame", _ex ); SIDL_CHECK(*_ex);
 
403
 
 
404
    /* pack in and inout arguments */
 
405
    if(iobj){
 
406
      char* _url = sidl_BaseInterface__getURL((sidl_BaseInterface)iobj,       \
 
407
        _ex);SIDL_CHECK(*_ex);
 
408
      sidl_rmi_Invocation_packString( _inv, "iobj", _url, _ex);SIDL_CHECK(    \
 
409
        *_ex);
 
410
      free((void*)_url);
 
411
    } else {
 
412
      sidl_rmi_Invocation_packString( _inv, "iobj", NULL, _ex);SIDL_CHECK(    \
 
413
        *_ex);
 
414
    }
 
415
 
 
416
    /* send actual RMI request */
 
417
    _rsvp = sidl_rmi_Invocation_invokeMethod(_inv, _ex);SIDL_CHECK(*_ex);
 
418
 
 
419
    _be = sidl_rmi_Response_getExceptionThrown(_rsvp, _ex);SIDL_CHECK(*_ex);
 
420
    if(_be != NULL) {
 
421
      struct sidl_BaseInterface__object* throwaway_exception = NULL;
 
422
sidl_BaseException_addLine(_be, "Exception unserialized from sidl.BaseClass.isSame.", &throwaway_exception);
 
423
      *_ex = (struct sidl_BaseInterface__object*) sidl_BaseInterface__cast(   \
 
424
        _be,&throwaway_exception);
 
425
      goto EXIT;
 
426
    }
 
427
 
 
428
    /* extract return value */
 
429
    sidl_rmi_Response_unpackBool( _rsvp, "_retval", &_retval, _ex);SIDL_CHECK(\
 
430
      *_ex);
 
431
 
 
432
    /* unpack out and inout arguments */
 
433
 
 
434
    /* cleanup and return */
 
435
    EXIT:
 
436
    if(_inv) { sidl_rmi_Invocation_deleteRef(_inv, &_throwaway); }
 
437
    if(_rsvp) { sidl_rmi_Response_deleteRef(_rsvp, &_throwaway); }
 
438
    return _retval;
 
439
  }
 
440
}
 
441
 
 
442
/* REMOTE METHOD STUB:isType */
 
443
static sidl_bool
 
444
remote_sidl_BaseClass_isType(
 
445
  /* in */ struct sidl_BaseClass__object *self ,
 
446
  /* in */ const char* name,
 
447
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
448
{
 
449
  LANG_SPECIFIC_INIT();
 
450
  *_ex = NULL;
 
451
  {
 
452
    /* initialize a new invocation */
 
453
    struct sidl_BaseInterface__object* _throwaway = NULL;
 
454
    sidl_BaseException _be = NULL;
 
455
    sidl_rmi_Response _rsvp = NULL;
 
456
    sidl_bool _retval = FALSE;
 
457
    struct sidl_rmi_InstanceHandle__object * _conn = ((struct                 \
 
458
      sidl_BaseClass__remote*)self->d_data)->d_ih;
 
459
    sidl_rmi_Invocation _inv = sidl_rmi_InstanceHandle_createInvocation(      \
 
460
      _conn, "isType", _ex ); SIDL_CHECK(*_ex);
 
461
 
 
462
    /* pack in and inout arguments */
 
463
    sidl_rmi_Invocation_packString( _inv, "name", name, _ex);SIDL_CHECK(*_ex);
 
464
 
 
465
    /* send actual RMI request */
 
466
    _rsvp = sidl_rmi_Invocation_invokeMethod(_inv, _ex);SIDL_CHECK(*_ex);
 
467
 
 
468
    _be = sidl_rmi_Response_getExceptionThrown(_rsvp, _ex);SIDL_CHECK(*_ex);
 
469
    if(_be != NULL) {
 
470
      struct sidl_BaseInterface__object* throwaway_exception = NULL;
 
471
sidl_BaseException_addLine(_be, "Exception unserialized from sidl.BaseClass.isType.", &throwaway_exception);
 
472
      *_ex = (struct sidl_BaseInterface__object*) sidl_BaseInterface__cast(   \
 
473
        _be,&throwaway_exception);
 
474
      goto EXIT;
 
475
    }
 
476
 
 
477
    /* extract return value */
 
478
    sidl_rmi_Response_unpackBool( _rsvp, "_retval", &_retval, _ex);SIDL_CHECK(\
 
479
      *_ex);
 
480
 
 
481
    /* unpack out and inout arguments */
 
482
 
 
483
    /* cleanup and return */
 
484
    EXIT:
 
485
    if(_inv) { sidl_rmi_Invocation_deleteRef(_inv, &_throwaway); }
 
486
    if(_rsvp) { sidl_rmi_Response_deleteRef(_rsvp, &_throwaway); }
 
487
    return _retval;
 
488
  }
 
489
}
 
490
 
 
491
/* REMOTE METHOD STUB:getClassInfo */
 
492
static struct sidl_ClassInfo__object*
 
493
remote_sidl_BaseClass_getClassInfo(
 
494
  /* in */ struct sidl_BaseClass__object *self ,
 
495
  /* out */ struct sidl_BaseInterface__object * *_ex)
 
496
{
 
497
  LANG_SPECIFIC_INIT();
 
498
  *_ex = NULL;
 
499
  {
 
500
    /* initialize a new invocation */
 
501
    struct sidl_BaseInterface__object* _throwaway = NULL;
 
502
    sidl_BaseException _be = NULL;
 
503
    sidl_rmi_Response _rsvp = NULL;
 
504
    char*_retval_str = NULL;
 
505
    struct sidl_ClassInfo__object* _retval = 0;
 
506
    struct sidl_rmi_InstanceHandle__object * _conn = ((struct                 \
 
507
      sidl_BaseClass__remote*)self->d_data)->d_ih;
 
508
    sidl_rmi_Invocation _inv = sidl_rmi_InstanceHandle_createInvocation(      \
 
509
      _conn, "getClassInfo", _ex ); SIDL_CHECK(*_ex);
 
510
 
 
511
    /* pack in and inout arguments */
 
512
 
 
513
    /* send actual RMI request */
 
514
    _rsvp = sidl_rmi_Invocation_invokeMethod(_inv, _ex);SIDL_CHECK(*_ex);
 
515
 
 
516
    _be = sidl_rmi_Response_getExceptionThrown(_rsvp, _ex);SIDL_CHECK(*_ex);
 
517
    if(_be != NULL) {
 
518
      struct sidl_BaseInterface__object* throwaway_exception = NULL;
 
519
sidl_BaseException_addLine(_be, "Exception unserialized from sidl.BaseClass.getClassInfo.", &throwaway_exception);
 
520
      *_ex = (struct sidl_BaseInterface__object*) sidl_BaseInterface__cast(   \
 
521
        _be,&throwaway_exception);
 
522
      goto EXIT;
 
523
    }
 
524
 
 
525
    /* extract return value */
 
526
    sidl_rmi_Response_unpackString( _rsvp, "_retval", &_retval_str,           \
 
527
      _ex);SIDL_CHECK(*_ex);
 
528
    _retval = sidl_ClassInfo__connectI(_retval_str, FALSE, _ex);SIDL_CHECK(   \
 
529
      *_ex);
 
530
 
 
531
    /* unpack out and inout arguments */
 
532
 
 
533
    /* cleanup and return */
 
534
    EXIT:
 
535
    if(_inv) { sidl_rmi_Invocation_deleteRef(_inv, &_throwaway); }
 
536
    if(_rsvp) { sidl_rmi_Response_deleteRef(_rsvp, &_throwaway); }
 
537
    return _retval;
 
538
  }
 
539
}
 
540
 
 
541
/* REMOTE EPV: create remote entry point vectors (EPVs). */
 
542
static void sidl_BaseClass__init_remote_epv(void)
 
543
{
 
544
  /* assert( HAVE_LOCKED_STATIC_GLOBALS ); */
 
545
  struct sidl_BaseClass__epv*     epv = &s_rem_epv__sidl_baseclass;
 
546
  struct sidl_BaseInterface__epv* e0  = &s_rem_epv__sidl_baseinterface;
 
547
 
 
548
  epv->f__cast             = remote_sidl_BaseClass__cast;
 
549
  epv->f__delete           = remote_sidl_BaseClass__delete;
 
550
  epv->f__exec             = remote_sidl_BaseClass__exec;
 
551
  epv->f__getURL           = remote_sidl_BaseClass__getURL;
 
552
  epv->f__raddRef          = remote_sidl_BaseClass__raddRef;
 
553
  epv->f__isRemote         = remote_sidl_BaseClass__isRemote;
 
554
  epv->f__set_hooks        = remote_sidl_BaseClass__set_hooks;
 
555
  epv->f__ctor             = NULL;
 
556
  epv->f__ctor2            = NULL;
 
557
  epv->f__dtor             = NULL;
 
558
  epv->f_addRef            = remote_sidl_BaseClass_addRef;
 
559
  epv->f_deleteRef         = remote_sidl_BaseClass_deleteRef;
 
560
  epv->f_isSame            = remote_sidl_BaseClass_isSame;
 
561
  epv->f_isType            = remote_sidl_BaseClass_isType;
 
562
  epv->f_getClassInfo      = remote_sidl_BaseClass_getClassInfo;
 
563
 
 
564
  e0->f__cast        = (void* (*)(void*,const char*, struct                   \
 
565
    sidl_BaseInterface__object**)) epv->f__cast;
 
566
  e0->f__delete      = (void (*)(void*,struct sidl_BaseInterface__object**))  \
 
567
    epv->f__delete;
 
568
  e0->f__getURL      = (char* (*)(void*,struct sidl_BaseInterface__object**)) \
 
569
    epv->f__getURL;
 
570
  e0->f__raddRef     = (void (*)(void*,struct sidl_BaseInterface__object**))  \
 
571
    epv->f__raddRef;
 
572
  e0->f__isRemote    = (sidl_bool (*)(void*,struct                            \
 
573
    sidl_BaseInterface__object**)) epv->f__isRemote;
 
574
  e0->f__set_hooks   = (void (*)(void*,int32_t, struct                        \
 
575
    sidl_BaseInterface__object**)) epv->f__set_hooks;
 
576
  e0->f__exec        = (void (*)(void*,const char*,struct                     \
 
577
    sidl_rmi_Call__object*,struct sidl_rmi_Return__object*,struct             \
 
578
    sidl_BaseInterface__object **)) epv->f__exec;
 
579
  e0->f_addRef       = (void (*)(void*,struct sidl_BaseInterface__object **)) \
 
580
    epv->f_addRef;
 
581
  e0->f_deleteRef    = (void (*)(void*,struct sidl_BaseInterface__object **)) \
 
582
    epv->f_deleteRef;
 
583
  e0->f_isSame       = (sidl_bool (*)(void*,struct                            \
 
584
    sidl_BaseInterface__object*,struct sidl_BaseInterface__object **))        \
 
585
    epv->f_isSame;
 
586
  e0->f_isType       = (sidl_bool (*)(void*,const char*,struct                \
 
587
    sidl_BaseInterface__object **)) epv->f_isType;
 
588
  e0->f_getClassInfo = (struct sidl_ClassInfo__object* (*)(void*,struct       \
 
589
    sidl_BaseInterface__object **)) epv->f_getClassInfo;
 
590
 
 
591
  s_remote_initialized = 1;
 
592
}
 
593
 
 
594
/* Create an instance that connects to an existing remote object. */
 
595
static struct sidl_BaseClass__object*
 
596
sidl_BaseClass__remoteConnect(const char *url, sidl_bool ar, struct           \
 
597
  sidl_BaseInterface__object* *_ex)
 
598
{
 
599
  struct sidl_BaseClass__object* self = NULL;
 
600
 
 
601
  struct sidl_BaseClass__object* s0;
 
602
 
 
603
  struct sidl_BaseClass__remote* r_obj = NULL;
 
604
  sidl_rmi_InstanceHandle instance = NULL;
 
605
  char* objectID = NULL;
 
606
  objectID = NULL;
 
607
  *_ex = NULL;
 
608
  if(url == NULL) {return NULL;}
 
609
  objectID = sidl_rmi_ServerRegistry_isLocalObject(url, _ex);
 
610
  if(objectID) {
 
611
    struct sidl_BaseClass__object* retobj = NULL;
 
612
    struct sidl_BaseInterface__object *throwaway_exception;
 
613
    sidl_BaseInterface bi = (                                                 \
 
614
      sidl_BaseInterface)sidl_rmi_InstanceRegistry_getInstanceByString(       \
 
615
      objectID, _ex); SIDL_CHECK(*_ex);
 
616
    (*bi->d_epv->f_deleteRef)(bi->d_object, &throwaway_exception);
 
617
    retobj = (struct sidl_BaseClass__object*) (*bi->d_epv->f__cast)(          \
 
618
      bi->d_object, "sidl.BaseClass", _ex);
 
619
    if(!ar) { 
 
620
      (*bi->d_epv->f_deleteRef)(bi->d_object, &throwaway_exception);
 
621
    }
 
622
    return retobj;
 
623
  }
 
624
  instance = sidl_rmi_ProtocolFactory_connectInstance(url, "sidl.BaseClass",  \
 
625
    ar, _ex ); SIDL_CHECK(*_ex);
 
626
  if ( instance == NULL) { return NULL; }
 
627
  self =
 
628
    (struct sidl_BaseClass__object*) malloc(
 
629
      sizeof(struct sidl_BaseClass__object));
 
630
 
 
631
  r_obj =
 
632
    (struct sidl_BaseClass__remote*) malloc(
 
633
      sizeof(struct sidl_BaseClass__remote));
 
634
 
 
635
  if(!self || !r_obj) {
 
636
    sidl_MemAllocException ex = sidl_MemAllocException_getSingletonException( \
 
637
      _ex);
 
638
    SIDL_CHECK(*_ex);
 
639
    sidl_MemAllocException_setNote(ex, "Out of memory.", _ex); SIDL_CHECK(    \
 
640
      *_ex);
 
641
    sidl_MemAllocException_add(ex, __FILE__, __LINE__,                        \
 
642
      "sidl.BaseClass.EPVgeneration", _ex);
 
643
    SIDL_CHECK(*_ex);
 
644
    *_ex = (struct sidl_BaseInterface__object*)ex;
 
645
    goto EXIT;
 
646
  }
 
647
 
 
648
  r_obj->d_refcount = 1;
 
649
  r_obj->d_ih = instance;
 
650
  s0 =                          self;
 
651
 
 
652
  LOCK_STATIC_GLOBALS;
 
653
  if (!s_remote_initialized) {
 
654
    sidl_BaseClass__init_remote_epv();
 
655
  }
 
656
  UNLOCK_STATIC_GLOBALS;
 
657
 
 
658
  s0->d_sidl_baseinterface.d_epv    = &s_rem_epv__sidl_baseinterface;
 
659
  s0->d_sidl_baseinterface.d_object = (void*) self;
 
660
 
 
661
  s0->d_data = (void*) r_obj;
 
662
  s0->d_epv  = &s_rem_epv__sidl_baseclass;
 
663
 
 
664
  self->d_data = (void*) r_obj;
 
665
 
 
666
  return self;
 
667
  EXIT:
 
668
  if(self) { free(self); }
 
669
  if(r_obj) { free(r_obj); }
 
670
  return NULL;
 
671
}
 
672
/* Create an instance that uses an already existing  */
 
673
/* InstanceHandle to connect to an existing remote object. */
 
674
static struct sidl_BaseClass__object*
 
675
sidl_BaseClass__IHConnect(sidl_rmi_InstanceHandle instance, struct            \
 
676
  sidl_BaseInterface__object* *_ex)
 
677
{
 
678
  struct sidl_BaseClass__object* self = NULL;
 
679
 
 
680
  struct sidl_BaseClass__object* s0;
 
681
 
 
682
  struct sidl_BaseClass__remote* r_obj = NULL;
 
683
  self =
 
684
    (struct sidl_BaseClass__object*) malloc(
 
685
      sizeof(struct sidl_BaseClass__object));
 
686
 
 
687
  r_obj =
 
688
    (struct sidl_BaseClass__remote*) malloc(
 
689
      sizeof(struct sidl_BaseClass__remote));
 
690
 
 
691
  if(!self || !r_obj) {
 
692
    sidl_MemAllocException ex = sidl_MemAllocException_getSingletonException( \
 
693
      _ex);
 
694
    SIDL_CHECK(*_ex);
 
695
    sidl_MemAllocException_setNote(ex, "Out of memory.", _ex); SIDL_CHECK(    \
 
696
      *_ex);
 
697
    sidl_MemAllocException_add(ex, __FILE__, __LINE__,                        \
 
698
      "sidl.BaseClass.EPVgeneration", _ex);
 
699
    SIDL_CHECK(*_ex);
 
700
    *_ex = (struct sidl_BaseInterface__object*)ex;
 
701
    goto EXIT;
 
702
  }
 
703
 
 
704
  r_obj->d_refcount = 1;
 
705
  r_obj->d_ih = instance;
 
706
  s0 =                          self;
 
707
 
 
708
  LOCK_STATIC_GLOBALS;
 
709
  if (!s_remote_initialized) {
 
710
    sidl_BaseClass__init_remote_epv();
 
711
  }
 
712
  UNLOCK_STATIC_GLOBALS;
 
713
 
 
714
  s0->d_sidl_baseinterface.d_epv    = &s_rem_epv__sidl_baseinterface;
 
715
  s0->d_sidl_baseinterface.d_object = (void*) self;
 
716
 
 
717
  s0->d_data = (void*) r_obj;
 
718
  s0->d_epv  = &s_rem_epv__sidl_baseclass;
 
719
 
 
720
  self->d_data = (void*) r_obj;
 
721
 
 
722
  sidl_rmi_InstanceHandle_addRef(instance,_ex);SIDL_CHECK(*_ex);
 
723
  return self;
 
724
  EXIT:
 
725
  if(self) { free(self); }
 
726
  if(r_obj) { free(r_obj); }
 
727
  return NULL;
 
728
}
 
729
/* REMOTE: generate remote instance given URL string. */
 
730
static struct sidl_BaseClass__object*
 
731
sidl_BaseClass__remoteCreate(const char *url, struct                          \
 
732
  sidl_BaseInterface__object **_ex)
 
733
{
 
734
  struct sidl_BaseInterface__object* _throwaway_exception = NULL;
 
735
  struct sidl_BaseClass__object* self = NULL;
 
736
 
 
737
  struct sidl_BaseClass__object* s0;
 
738
 
 
739
  struct sidl_BaseClass__remote* r_obj = NULL;
 
740
  sidl_rmi_InstanceHandle instance = sidl_rmi_ProtocolFactory_createInstance( \
 
741
    url, "sidl.BaseClass", _ex ); SIDL_CHECK(*_ex);
 
742
  if ( instance == NULL) { return NULL; }
 
743
  self =
 
744
    (struct sidl_BaseClass__object*) malloc(
 
745
      sizeof(struct sidl_BaseClass__object));
 
746
 
 
747
  r_obj =
 
748
    (struct sidl_BaseClass__remote*) malloc(
 
749
      sizeof(struct sidl_BaseClass__remote));
 
750
 
 
751
  if(!self || !r_obj) {
 
752
    sidl_MemAllocException ex = sidl_MemAllocException_getSingletonException( \
 
753
      _ex);
 
754
    SIDL_CHECK(*_ex);
 
755
    sidl_MemAllocException_setNote(ex, "Out of memory.", _ex); SIDL_CHECK(    \
 
756
      *_ex);
 
757
    sidl_MemAllocException_add(ex, __FILE__, __LINE__,                        \
 
758
      "sidl.BaseClass.EPVgeneration", _ex);
 
759
    SIDL_CHECK(*_ex);
 
760
    *_ex = (struct sidl_BaseInterface__object*)ex;
 
761
    goto EXIT;
 
762
  }
 
763
 
 
764
  r_obj->d_refcount = 1;
 
765
  r_obj->d_ih = instance;
 
766
  s0 =                          self;
 
767
 
 
768
  LOCK_STATIC_GLOBALS;
 
769
  if (!s_remote_initialized) {
 
770
    sidl_BaseClass__init_remote_epv();
 
771
  }
 
772
  UNLOCK_STATIC_GLOBALS;
 
773
 
 
774
  s0->d_sidl_baseinterface.d_epv    = &s_rem_epv__sidl_baseinterface;
 
775
  s0->d_sidl_baseinterface.d_object = (void*) self;
 
776
 
 
777
  s0->d_data = (void*) r_obj;
 
778
  s0->d_epv  = &s_rem_epv__sidl_baseclass;
 
779
 
 
780
  self->d_data = (void*) r_obj;
 
781
 
 
782
  return self;
 
783
  EXIT:
 
784
  if(instance) { sidl_rmi_InstanceHandle_deleteRef(instance,                  \
 
785
    &_throwaway_exception); }
 
786
  if(self) { free(self); }
 
787
  if(r_obj) { free(r_obj); }
 
788
  return NULL;
 
789
}
 
790
/*
 
791
 * RMI connector function for the class.
 
792
 */
 
793
 
 
794
struct sidl_BaseClass__object*
 
795
sidl_BaseClass__connectI(const char* url, sidl_bool ar, struct                \
 
796
  sidl_BaseInterface__object **_ex)
 
797
{
 
798
  return sidl_BaseClass__remoteConnect(url, ar, _ex);
 
799
}
 
800
 
 
801
 
 
802
#endif /*WITH_RMI*/
 
803
#ifdef WITH_RMI
 
804
 
 
805
static PyObject *
 
806
pStub_BaseClass__connect(PyObject *_ignored, PyObject *_args, PyObject        \
 
807
  *_kwdict) {
 
808
  PyObject *_return_value = NULL;
 
809
  struct sidl_BaseClass__object* self = NULL;
 
810
  char* url = NULL;
 
811
  struct sidl_BaseInterface__object *_exception = NULL;
 
812
  static char *_kwlist[] = {
 
813
    "url",
 
814
    NULL
 
815
  };
 
816
  int _okay;
 
817
  sidl_rmi_NetworkException__import();
 
818
  _okay = PyArg_ParseTupleAndKeywords(
 
819
    _args, _kwdict, 
 
820
    "z", _kwlist,
 
821
    &url);
 
822
  if (_okay) {
 
823
    self = sidl_BaseClass__remoteConnect(url,1,&_exception);
 
824
    if (_exception) {
 
825
      struct sidl_rmi_NetworkException__object *_ex0;
 
826
      if ((_ex0 = (struct sidl_rmi_NetworkException__object *)
 
827
      sidl_PyExceptionCast(_exception, "sidl.rmi.NetworkException"))) {
 
828
        struct sidl_BaseInterface__object *throwaway_exception;
 
829
        PyObject *_obj = sidl_rmi_NetworkException__wrap(_ex0);
 
830
        PyObject *_eargs = PyTuple_New(1);
 
831
        PyTuple_SetItem(_eargs, 0, _obj);
 
832
        _obj = PyObject_CallObject(sidl_rmi_NetworkException__type, _eargs);
 
833
        PyErr_SetObject(sidl_rmi_NetworkException__type, _obj);
 
834
        Py_XDECREF(_obj);
 
835
        (*(_exception->d_epv->f_deleteRef))(_exception->d_object,             \
 
836
          &throwaway_exception);
 
837
        Py_XDECREF(_eargs);
 
838
      }
 
839
    }
 
840
    else {
 
841
      _return_value = Py_BuildValue(
 
842
        "O&",
 
843
        (void *)sidl_BaseClass__wrap, self);
 
844
    }
 
845
  }
 
846
  return _return_value;
 
847
}
 
848
 
 
849
 
 
850
#endif /*WITH_RMI*/
 
851
staticforward PyTypeObject _sidl_BaseClassType;
 
852
 
 
853
static const struct sidl_BaseClass__external *_implEPV = NULL;
 
854
 
 
855
static PyObject *
 
856
pStub_BaseClass__exec(PyObject *_self, PyObject *_args, PyObject *_kwdict) {
 
857
  PyObject *_return_value = NULL;
 
858
  struct sidl_BaseClass__object *_self_ior =
 
859
    ((struct sidl_BaseClass__object *)
 
860
     sidl_Cast(_self, "sidl.BaseClass"));
 
861
  if (_self_ior) {
 
862
    char* methodName = NULL;
 
863
    struct sidl_rmi_Call__object* inArgs = NULL;
 
864
    struct sidl_rmi_Return__object* outArgs = NULL;
 
865
    struct sidl_BaseInterface__object *_exception = NULL;
 
866
    static char *_kwlist[] = {
 
867
      "methodName",
 
868
      "inArgs",
 
869
      "outArgs",
 
870
      NULL
 
871
    };
 
872
    int _okay;
 
873
    sidl_RuntimeException__import();
 
874
    sidl_rmi_Call__import();
 
875
    sidl_rmi_Return__import();
 
876
    _okay = PyArg_ParseTupleAndKeywords(
 
877
      _args, _kwdict, 
 
878
      "zO&O&", _kwlist,
 
879
      &methodName,
 
880
      (void *)sidl_rmi_Call__convert, &inArgs,
 
881
      (void *)sidl_rmi_Return__convert, &outArgs);
 
882
    if (_okay) {
 
883
      (*(_self_ior->d_epv->f__exec))(_self_ior, methodName, inArgs, outArgs,  \
 
884
        &_exception);
 
885
      if (_exception) {
 
886
        struct sidl_RuntimeException__object *_ex0;
 
887
        if ((_ex0 = (struct sidl_RuntimeException__object *)
 
888
        sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
889
          struct sidl_BaseInterface__object *throwaway_exception;
 
890
          PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
891
          PyObject *_eargs = PyTuple_New(1);
 
892
          PyTuple_SetItem(_eargs, 0, _obj);
 
893
          _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
894
          PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
895
          Py_XDECREF(_obj);
 
896
          (*(_exception->d_epv->f_deleteRef))(_exception->d_object,           \
 
897
            &throwaway_exception);
 
898
          Py_XDECREF(_eargs);
 
899
        }
 
900
      }
 
901
      else {
 
902
        _return_value = Py_None;
 
903
        Py_INCREF(_return_value);
 
904
      }
 
905
      sidl_rmi_Call_deref(inArgs);
 
906
      sidl_rmi_Return_deref(outArgs);
 
907
    }
 
908
    {
 
909
      struct sidl_BaseInterface__object *throwaway_exception;
 
910
      (*(_self_ior->d_epv->f_deleteRef))(_self_ior, &throwaway_exception);
 
911
    }
 
912
  }
 
913
  else {
 
914
    PyErr_SetString(PyExc_TypeError, 
 
915
      "self pointer is not a sidl.BaseClass");
 
916
  }
 
917
  return _return_value;
 
918
}
 
919
 
 
920
static PyObject *
 
921
pStub_BaseClass__getURL(PyObject *_self, PyObject *_args, PyObject *_kwdict) {
 
922
  PyObject *_return_value = NULL;
 
923
  struct sidl_BaseClass__object *_self_ior =
 
924
    ((struct sidl_BaseClass__object *)
 
925
     sidl_Cast(_self, "sidl.BaseClass"));
 
926
  if (_self_ior) {
 
927
    struct sidl_BaseInterface__object *_exception = NULL;
 
928
    static char *_kwlist[] = {
 
929
      NULL
 
930
    };
 
931
    int _okay;
 
932
    sidl_RuntimeException__import();
 
933
    _okay = PyArg_ParseTupleAndKeywords(
 
934
      _args, _kwdict, 
 
935
      "", _kwlist);
 
936
    if (_okay) {
 
937
      char* _return = NULL;
 
938
      _return = (*(_self_ior->d_epv->f__getURL))(_self_ior, &_exception);
 
939
      if (_exception) {
 
940
        struct sidl_RuntimeException__object *_ex0;
 
941
        if ((_ex0 = (struct sidl_RuntimeException__object *)
 
942
        sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
943
          struct sidl_BaseInterface__object *throwaway_exception;
 
944
          PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
945
          PyObject *_eargs = PyTuple_New(1);
 
946
          PyTuple_SetItem(_eargs, 0, _obj);
 
947
          _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
948
          PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
949
          Py_XDECREF(_obj);
 
950
          (*(_exception->d_epv->f_deleteRef))(_exception->d_object,           \
 
951
            &throwaway_exception);
 
952
          Py_XDECREF(_eargs);
 
953
        }
 
954
      }
 
955
      else {
 
956
        _return_value = Py_BuildValue(
 
957
          "z",
 
958
          _return);
 
959
        free((void *)_return);
 
960
      }
 
961
    }
 
962
    {
 
963
      struct sidl_BaseInterface__object *throwaway_exception;
 
964
      (*(_self_ior->d_epv->f_deleteRef))(_self_ior, &throwaway_exception);
 
965
    }
 
966
  }
 
967
  else {
 
968
    PyErr_SetString(PyExc_TypeError, 
 
969
      "self pointer is not a sidl.BaseClass");
 
970
  }
 
971
  return _return_value;
 
972
}
 
973
 
 
974
static PyObject *
 
975
pStub_BaseClass__isLocal(PyObject *_self, PyObject *_args, PyObject *_kwdict) \
 
976
  {
 
977
  PyObject *_return_value = NULL;
 
978
  struct sidl_BaseClass__object *_self_ior =
 
979
    ((struct sidl_BaseClass__object *)
 
980
     sidl_Cast(_self, "sidl.BaseClass"));
 
981
  if (_self_ior) {
 
982
    struct sidl_BaseInterface__object *_exception = NULL;
 
983
    static char *_kwlist[] = {
 
984
      NULL
 
985
    };
 
986
    int _okay;
 
987
    sidl_RuntimeException__import();
 
988
    _okay = PyArg_ParseTupleAndKeywords(
 
989
      _args, _kwdict, 
 
990
      "", _kwlist);
 
991
    if (_okay) {
 
992
      sidl_bool _return = (sidl_bool) 0;
 
993
      int _proxy__return;
 
994
      _return = !(*(_self_ior->d_epv->f__isRemote))(_self_ior, &_exception);
 
995
      _proxy__return = _return;
 
996
      if (_exception) {
 
997
        struct sidl_RuntimeException__object *_ex0;
 
998
        if ((_ex0 = (struct sidl_RuntimeException__object *)
 
999
        sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
1000
          struct sidl_BaseInterface__object *throwaway_exception;
 
1001
          PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
1002
          PyObject *_eargs = PyTuple_New(1);
 
1003
          PyTuple_SetItem(_eargs, 0, _obj);
 
1004
          _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
1005
          PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
1006
          Py_XDECREF(_obj);
 
1007
          (*(_exception->d_epv->f_deleteRef))(_exception->d_object,           \
 
1008
            &throwaway_exception);
 
1009
          Py_XDECREF(_eargs);
 
1010
        }
 
1011
      }
 
1012
      else {
 
1013
        _return_value = Py_BuildValue(
 
1014
          "i",
 
1015
          _proxy__return);
 
1016
      }
 
1017
    }
 
1018
    {
 
1019
      struct sidl_BaseInterface__object *throwaway_exception;
 
1020
      (*(_self_ior->d_epv->f_deleteRef))(_self_ior, &throwaway_exception);
 
1021
    }
 
1022
  }
 
1023
  else {
 
1024
    PyErr_SetString(PyExc_TypeError, 
 
1025
      "self pointer is not a sidl.BaseClass");
 
1026
  }
 
1027
  return _return_value;
 
1028
}
 
1029
 
 
1030
static PyObject *
 
1031
pStub_BaseClass__isRemote(PyObject *_self, PyObject *_args, PyObject          \
 
1032
  *_kwdict) {
 
1033
  PyObject *_return_value = NULL;
 
1034
  struct sidl_BaseClass__object *_self_ior =
 
1035
    ((struct sidl_BaseClass__object *)
 
1036
     sidl_Cast(_self, "sidl.BaseClass"));
 
1037
  if (_self_ior) {
 
1038
    struct sidl_BaseInterface__object *_exception = NULL;
 
1039
    static char *_kwlist[] = {
 
1040
      NULL
 
1041
    };
 
1042
    int _okay;
 
1043
    sidl_RuntimeException__import();
 
1044
    _okay = PyArg_ParseTupleAndKeywords(
 
1045
      _args, _kwdict, 
 
1046
      "", _kwlist);
 
1047
    if (_okay) {
 
1048
      sidl_bool _return = (sidl_bool) 0;
 
1049
      int _proxy__return;
 
1050
      _return = (*(_self_ior->d_epv->f__isRemote))(_self_ior, &_exception);
 
1051
      _proxy__return = _return;
 
1052
      if (_exception) {
 
1053
        struct sidl_RuntimeException__object *_ex0;
 
1054
        if ((_ex0 = (struct sidl_RuntimeException__object *)
 
1055
        sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
1056
          struct sidl_BaseInterface__object *throwaway_exception;
 
1057
          PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
1058
          PyObject *_eargs = PyTuple_New(1);
 
1059
          PyTuple_SetItem(_eargs, 0, _obj);
 
1060
          _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
1061
          PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
1062
          Py_XDECREF(_obj);
 
1063
          (*(_exception->d_epv->f_deleteRef))(_exception->d_object,           \
 
1064
            &throwaway_exception);
 
1065
          Py_XDECREF(_eargs);
 
1066
        }
 
1067
      }
 
1068
      else {
 
1069
        _return_value = Py_BuildValue(
 
1070
          "i",
 
1071
          _proxy__return);
 
1072
      }
 
1073
    }
 
1074
    {
 
1075
      struct sidl_BaseInterface__object *throwaway_exception;
 
1076
      (*(_self_ior->d_epv->f_deleteRef))(_self_ior, &throwaway_exception);
 
1077
    }
 
1078
  }
 
1079
  else {
 
1080
    PyErr_SetString(PyExc_TypeError, 
 
1081
      "self pointer is not a sidl.BaseClass");
 
1082
  }
 
1083
  return _return_value;
 
1084
}
 
1085
 
 
1086
static PyObject *
 
1087
pStub_BaseClass__set_hooks(PyObject *_self, PyObject *_args, PyObject         \
 
1088
  *_kwdict) {
 
1089
  PyObject *_return_value = NULL;
 
1090
  struct sidl_BaseClass__object *_self_ior =
 
1091
    ((struct sidl_BaseClass__object *)
 
1092
     sidl_Cast(_self, "sidl.BaseClass"));
 
1093
  if (_self_ior) {
 
1094
    sidl_bool on = (sidl_bool) 0;
 
1095
    struct sidl_BaseInterface__object *_exception = NULL;
 
1096
    int _proxy_on;
 
1097
    static char *_kwlist[] = {
 
1098
      "on",
 
1099
      NULL
 
1100
    };
 
1101
    int _okay;
 
1102
    sidl_RuntimeException__import();
 
1103
    _okay = PyArg_ParseTupleAndKeywords(
 
1104
      _args, _kwdict, 
 
1105
      "i", _kwlist,
 
1106
      &_proxy_on);
 
1107
    if (_okay) {
 
1108
      on = (_proxy_on ? (TRUE) : (FALSE));
 
1109
      (*(_self_ior->d_epv->f__set_hooks))(_self_ior, on, &_exception);
 
1110
      if (_exception) {
 
1111
        struct sidl_RuntimeException__object *_ex0;
 
1112
        if ((_ex0 = (struct sidl_RuntimeException__object *)
 
1113
        sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
1114
          struct sidl_BaseInterface__object *throwaway_exception;
 
1115
          PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
1116
          PyObject *_eargs = PyTuple_New(1);
 
1117
          PyTuple_SetItem(_eargs, 0, _obj);
 
1118
          _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
1119
          PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
1120
          Py_XDECREF(_obj);
 
1121
          (*(_exception->d_epv->f_deleteRef))(_exception->d_object,           \
 
1122
            &throwaway_exception);
 
1123
          Py_XDECREF(_eargs);
 
1124
        }
 
1125
      }
 
1126
      else {
 
1127
        _return_value = Py_None;
 
1128
        Py_INCREF(_return_value);
 
1129
      }
 
1130
    }
 
1131
    {
 
1132
      struct sidl_BaseInterface__object *throwaway_exception;
 
1133
      (*(_self_ior->d_epv->f_deleteRef))(_self_ior, &throwaway_exception);
 
1134
    }
 
1135
  }
 
1136
  else {
 
1137
    PyErr_SetString(PyExc_TypeError, 
 
1138
      "self pointer is not a sidl.BaseClass");
 
1139
  }
 
1140
  return _return_value;
 
1141
}
 
1142
 
 
1143
static int
 
1144
sidl_BaseClass_createCast(PyObject *self, PyObject *args, PyObject *kwds) {
 
1145
  struct sidl_BaseClass__object *optarg = NULL;
 
1146
  char* url = NULL;
 
1147
  PyObject * implObj = NULL;
 
1148
  static char *_kwlist[] = {"sobj",  "url", "impl", NULL };
 
1149
  int _okay = PyArg_ParseTupleAndKeywords(args, kwds, "|O&zO", _kwlist, (void \
 
1150
    *)sidl_BaseClass__convert, &optarg, &url, &implObj);
 
1151
  if (_okay) {
 
1152
    if (!optarg && !url && !implObj) {
 
1153
      struct sidl_BaseInterface__object *_exception;
 
1154
      optarg = (*(_implEPV->createObject))(NULL,&_exception);
 
1155
      if (_exception) {
 
1156
        sidl_RuntimeException__import();
 
1157
        {
 
1158
          struct sidl_RuntimeException__object *_ex0;
 
1159
          if ((_ex0 = (struct sidl_RuntimeException__object *)
 
1160
          sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
1161
            struct sidl_BaseInterface__object *throwaway_exception;
 
1162
            PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
1163
            PyObject *_eargs = PyTuple_New(1);
 
1164
            PyTuple_SetItem(_eargs, 0, _obj);
 
1165
            _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
1166
            PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
1167
            Py_XDECREF(_obj);
 
1168
            (*(_exception->d_epv->f_deleteRef))(_exception->d_object,         \
 
1169
              &throwaway_exception);
 
1170
            Py_XDECREF(_eargs);
 
1171
          }
 
1172
          return -1;
 
1173
        }
 
1174
      }
 
1175
    }
 
1176
    else if (!optarg && !url && implObj) {
 
1177
      struct sidl_BaseInterface__object *_exception;
 
1178
      Py_INCREF(implObj);
 
1179
      optarg = (*(_implEPV->createObject))((void*)implObj,&_exception);
 
1180
      if (_exception) {
 
1181
        sidl_RuntimeException__import();
 
1182
        {
 
1183
          struct sidl_RuntimeException__object *_ex0;
 
1184
          if ((_ex0 = (struct sidl_RuntimeException__object *)
 
1185
          sidl_PyExceptionCast(_exception, "sidl.RuntimeException"))) {
 
1186
            struct sidl_BaseInterface__object *throwaway_exception;
 
1187
            PyObject *_obj = sidl_RuntimeException__wrap(_ex0);
 
1188
            PyObject *_eargs = PyTuple_New(1);
 
1189
            PyTuple_SetItem(_eargs, 0, _obj);
 
1190
            _obj = PyObject_CallObject(sidl_RuntimeException__type, _eargs);
 
1191
            PyErr_SetObject(sidl_RuntimeException__type, _obj);
 
1192
            Py_XDECREF(_obj);
 
1193
            (*(_exception->d_epv->f_deleteRef))(_exception->d_object,         \
 
1194
              &throwaway_exception);
 
1195
            Py_XDECREF(_eargs);
 
1196
          }
 
1197
          return -1;
 
1198
        }
 
1199
      }
 
1200
  }
 
1201
 
 
1202
#ifdef WITH_RMI
 
1203
 
 
1204
  else if(url && !optarg && !implObj) {
 
1205
    struct sidl_BaseInterface__object *_exception = NULL;
 
1206
    optarg = sidl_BaseClass__remoteCreate(url,&_exception);
 
1207
    if (_exception) {
 
1208
      sidl_rmi_NetworkException__import();
 
1209
      struct sidl_rmi_NetworkException__object *_ex0;
 
1210
      if ((_ex0 = (struct sidl_rmi_NetworkException__object *)
 
1211
      sidl_PyExceptionCast(_exception, "sidl.rmi.NetworkException"))) {
 
1212
        struct sidl_BaseInterface__object *throwaway_exception;
 
1213
        PyObject *_obj = sidl_rmi_NetworkException__wrap(_ex0);
 
1214
        PyObject *_eargs = PyTuple_New(1);
 
1215
        PyTuple_SetItem(_eargs, 0, _obj);
 
1216
        _obj = PyObject_CallObject(sidl_rmi_NetworkException__type, _eargs);
 
1217
        PyErr_SetObject(sidl_rmi_NetworkException__type, _obj);
 
1218
        Py_XDECREF(_obj);
 
1219
        (*(_exception->d_epv->f_deleteRef))(_exception->d_object,             \
 
1220
          &throwaway_exception);
 
1221
        Py_XDECREF(_eargs);
 
1222
      }
 
1223
      return -1;
 
1224
    }
 
1225
  }
 
1226
 
 
1227
#endif /*WITH_RMI*/
 
1228
 
 
1229
  /* OK, but fall though */
 
1230
  else if(!url && optarg && !implObj) {}
 
1231
  /* Error case. */
 
1232
  else {
 
1233
    return -1;
 
1234
  }
 
1235
  return sidl_Object_Init(
 
1236
    (SPObject *)self,
 
1237
    (struct sidl_BaseInterface__object *)optarg,
 
1238
    sidl_PyStealRef);
 
1239
}
 
1240
return -1;
 
1241
}
 
1242
 
 
1243
static PyMethodDef _BaseClassModuleMethods[] = {
 
1244
 
 
1245
#ifdef WITH_RMI
 
1246
 
 
1247
  { "_connect", (PyCFunction)pStub_BaseClass__connect,
 
1248
  (METH_VARARGS | METH_KEYWORDS),
 
1249
"\
 
1250
_connect( in string url)\n\
 
1251
RETURNS\n\
 
1252
   ( out sidl.BaseClass self)\n\
 
1253
RAISES\n\
 
1254
    sidl.rmi.NetworkException\n\
 
1255
"
 
1256
   },
 
1257
 
 
1258
#endif /*WITH_RMI*/
 
1259
 
 
1260
  { NULL, NULL }
 
1261
};
 
1262
 
 
1263
static PyMethodDef _BaseClassObjectMethods[] = {
 
1264
  { "_exec", (PyCFunction)pStub_BaseClass__exec,
 
1265
  (METH_VARARGS | METH_KEYWORDS),
 
1266
"\
 
1267
_exec( in string methodName,\n\
 
1268
       in sidl.rmi.Call inArgs,\n\
 
1269
       in sidl.rmi.Return outArgs)\n\
 
1270
RETURNS\n\
 
1271
    None\n\
 
1272
RAISES\n\
 
1273
    sidl.RuntimeException\n\
 
1274
\n\
 
1275
\
 
1276
Select and execute a method by name"
 
1277
   },
 
1278
  { "_getURL", (PyCFunction)pStub_BaseClass__getURL,
 
1279
  (METH_VARARGS | METH_KEYWORDS),
 
1280
"\
 
1281
_getURL()\n\
 
1282
RETURNS\n\
 
1283
   (string _return)\n\
 
1284
RAISES\n\
 
1285
    sidl.RuntimeException\n\
 
1286
\n\
 
1287
\
 
1288
Get the URL of the Implementation of this object (for RMI)"
 
1289
   },
 
1290
  { "_isLocal", (PyCFunction)pStub_BaseClass__isLocal,
 
1291
  (METH_VARARGS | METH_KEYWORDS),
 
1292
"\
 
1293
_isLocal()\n\
 
1294
RETURNS\n\
 
1295
   (bool _return)\n\
 
1296
RAISES\n\
 
1297
    sidl.RuntimeException\n\
 
1298
\n\
 
1299
\
 
1300
TRUE if this object is local, false if remote"
 
1301
   },
 
1302
  { "_isRemote", (PyCFunction)pStub_BaseClass__isRemote,
 
1303
  (METH_VARARGS | METH_KEYWORDS),
 
1304
"\
 
1305
_isRemote()\n\
 
1306
RETURNS\n\
 
1307
   (bool _return)\n\
 
1308
RAISES\n\
 
1309
    sidl.RuntimeException\n\
 
1310
\n\
 
1311
\
 
1312
TRUE if this object is remote, false if local"
 
1313
   },
 
1314
  { "_set_hooks", (PyCFunction)pStub_BaseClass__set_hooks,
 
1315
  (METH_VARARGS | METH_KEYWORDS),
 
1316
"\
 
1317
_set_hooks( in bool on)\n\
 
1318
RETURNS\n\
 
1319
    None\n\
 
1320
RAISES\n\
 
1321
    sidl.RuntimeException\n\
 
1322
\n\
 
1323
\
 
1324
Method to set whether or not method hooks should be invoked."
 
1325
   },
 
1326
  { NULL, NULL }
 
1327
};
 
1328
 
 
1329
static PyTypeObject _sidl_BaseClassType = {
 
1330
  PyObject_HEAD_INIT(NULL)
 
1331
  0,      /* ob_size */
 
1332
  "sidl.BaseClass.BaseClass", /* tp_name */
 
1333
  0,      /* tp_basicsize */
 
1334
  0,      /* tp_itemsize */
 
1335
  0,      /* tp_dealloc */
 
1336
  0,      /* tp_print */
 
1337
  0,      /* tp_getattr */
 
1338
  0,      /* tp_setattr */
 
1339
  0,      /* tp_compare */
 
1340
  0,      /* tp_repr */
 
1341
  0,      /* tp_as_number */
 
1342
  0,      /* tp_as_sequence */
 
1343
  0,      /* tp_as_mapping */
 
1344
  0,      /* tp_hash  */
 
1345
  0,      /* tp_call */
 
1346
  0,      /* tp_str */
 
1347
  0,      /* tp_getattro */
 
1348
  0,      /* tp_setattro */
 
1349
  0,      /* tp_as_buffer */
 
1350
  Py_TPFLAGS_DEFAULT, /* tp_flags */
 
1351
  "\
 
1352
\
 
1353
Every class implicitly inherits from <code>BaseClass</code>.  This\n\
 
1354
class implements the methods in <code>BaseInterface</code>.", /* tp_doc */
 
1355
  0,      /* tp_traverse */
 
1356
  0,       /* tp_clear */
 
1357
  0,       /* tp_richcompare */
 
1358
  0,       /* tp_weaklistoffset */
 
1359
  0,       /* tp_iter */
 
1360
  0,       /* tp_iternext */
 
1361
  _BaseClassObjectMethods, /* tp_methods */
 
1362
  0,       /* tp_members */
 
1363
  0,       /* tp_getset */
 
1364
  0,       /* tp_base */
 
1365
  0,       /* tp_dict */
 
1366
  0,       /* tp_descr_get */
 
1367
  0,       /* tp_descr_set */
 
1368
  0,       /* tp_dictoffset */
 
1369
  sidl_BaseClass_createCast,   /* tp_init */
 
1370
  0,       /* tp_alloc */
 
1371
  0,       /* tp_new */
 
1372
};
 
1373
 
 
1374
sidl_BaseClass__wrap_RETURN
 
1375
sidl_BaseClass__wrap sidl_BaseClass__wrap_PROTO {
 
1376
  PyObject *result;
 
1377
  if (sidlobj) {
 
1378
    result = _sidl_BaseClassType.tp_new(&_sidl_BaseClassType, NULL, NULL);
 
1379
    if (result) {
 
1380
      if (sidl_Object_Init(
 
1381
        (SPObject *)result,
 
1382
        (struct sidl_BaseInterface__object *)(sidlobj),
 
1383
        sidl_PyStealRef))
 
1384
      {
 
1385
        Py_DECREF(result);
 
1386
        result = NULL;
 
1387
      }
 
1388
    }
 
1389
  }
 
1390
  else {
 
1391
    result = Py_None;
 
1392
    Py_INCREF(result);
 
1393
  }
 
1394
  return result;
 
1395
}
 
1396
 
 
1397
sidl_BaseClass__weakRef_RETURN
 
1398
sidl_BaseClass__weakRef sidl_BaseClass__weakRef_PROTO {
 
1399
  PyObject *result;
 
1400
  if (sidlobj) {
 
1401
    result = _sidl_BaseClassType.tp_new(&_sidl_BaseClassType, NULL, NULL);
 
1402
    if (result) {
 
1403
      if (sidl_Object_Init(
 
1404
        (SPObject *)result,
 
1405
        (struct sidl_BaseInterface__object *)(sidlobj),
 
1406
        sidl_PyWeakRef))
 
1407
      {
 
1408
        Py_DECREF(result);
 
1409
        result = NULL;
 
1410
      }
 
1411
    }
 
1412
  }
 
1413
  else {
 
1414
    result = Py_None;
 
1415
    Py_INCREF(result);
 
1416
  }
 
1417
  return result;
 
1418
}
 
1419
 
 
1420
sidl_BaseClass_deref_RETURN
 
1421
sidl_BaseClass_deref sidl_BaseClass_deref_PROTO {
 
1422
  if (sidlobj) {
 
1423
    struct sidl_BaseInterface__object *throwaway_exception;
 
1424
    (*(sidlobj->d_epv->f_deleteRef))(sidlobj, &throwaway_exception);
 
1425
  }
 
1426
}
 
1427
 
 
1428
sidl_BaseClass__newRef_RETURN
 
1429
sidl_BaseClass__newRef sidl_BaseClass__newRef_PROTO {
 
1430
  PyObject *result;
 
1431
  if (sidlobj) {
 
1432
    result = _sidl_BaseClassType.tp_new(&_sidl_BaseClassType, NULL, NULL);
 
1433
    if (result) {
 
1434
      if (sidl_Object_Init(
 
1435
        (SPObject *)result,
 
1436
        (struct sidl_BaseInterface__object *)(sidlobj),
 
1437
        sidl_PyNewRef))
 
1438
      {
 
1439
        Py_DECREF(result);
 
1440
        result = NULL;
 
1441
      }
 
1442
    }
 
1443
  }
 
1444
  else {
 
1445
    result = Py_None;
 
1446
    Py_INCREF(result);
 
1447
  }
 
1448
  return result;
 
1449
}
 
1450
 
 
1451
sidl_BaseClass__addRef_RETURN
 
1452
sidl_BaseClass__addRef sidl_BaseClass__addRef_PROTO {
 
1453
  if (sidlobj) {
 
1454
    struct sidl_BaseInterface__object *throwaway_exception;
 
1455
    (*(sidlobj->d_epv->f_addRef))(sidlobj, &throwaway_exception);
 
1456
  }
 
1457
}
 
1458
 
 
1459
sidl_BaseClass_PyType_RETURN
 
1460
sidl_BaseClass_PyType sidl_BaseClass_PyType_PROTO {
 
1461
  Py_INCREF(&_sidl_BaseClassType);
 
1462
  return &_sidl_BaseClassType;
 
1463
}
 
1464
 
 
1465
sidl_BaseClass__convert_RETURN
 
1466
sidl_BaseClass__convert sidl_BaseClass__convert_PROTO {
 
1467
  if (*sidlobj) {
 
1468
    struct sidl_BaseInterface__object *throwaway_exception;
 
1469
    (*((*sidlobj)->d_epv->f_deleteRef))((*sidlobj), &throwaway_exception);
 
1470
  }
 
1471
  *sidlobj = sidl_Cast(obj, "sidl.BaseClass");
 
1472
  if ((!(*sidlobj)) && (obj != Py_None)) {
 
1473
    PyErr_SetString(PyExc_TypeError, 
 
1474
      "argument is not a(n) sidl.BaseClass");
 
1475
    return 0;
 
1476
  }
 
1477
  return 1;
 
1478
}
 
1479
 
 
1480
static int
 
1481
_convertPython(void *sidlarray, const int *ind, PyObject *pyobj)
 
1482
{
 
1483
  struct sidl_BaseClass__object *sidlobj = NULL;
 
1484
  if (sidl_BaseClass__convert(pyobj, &sidlobj)) {
 
1485
    sidl_interface__array_set((struct sidl_interface__array *)sidlarray,
 
1486
    ind, (struct sidl_BaseInterface__object *)sidlobj);
 
1487
    if (sidlobj) {
 
1488
      struct sidl_BaseInterface__object *asInt = (struct                      \
 
1489
        sidl_BaseInterface__object *)sidlobj;
 
1490
      struct sidl_BaseInterface__object *throwaway_exception;
 
1491
      (*asInt->d_epv->f_deleteRef)(asInt->d_object, &throwaway_exception);
 
1492
    }
 
1493
    return FALSE;
 
1494
  }
 
1495
  return TRUE;
 
1496
}
 
1497
 
 
1498
sidl_BaseClass__convert_python_array_RETURN
 
1499
sidl_BaseClass__convert_python_array                                          \
 
1500
  sidl_BaseClass__convert_python_array_PROTO {
 
1501
  int result = 0;
 
1502
  if (*sidlarray) {
 
1503
    sidl__array_deleteRef((struct sidl__array *)*sidlarray);
 
1504
    *sidlarray = NULL;
 
1505
  }
 
1506
  if (obj == Py_None) {
 
1507
    result = TRUE;
 
1508
  }
 
1509
  else {
 
1510
    PyObject *pya = PyArray_FromObject(obj, PyArray_OBJECT, 0, 0);
 
1511
    if (pya) {
 
1512
      if (PyArray_OBJECT == ((PyArrayObject *)pya)->descr->type_num) {
 
1513
        int dimen, lower[SIDL_MAX_ARRAY_DIMENSION],
 
1514
          upper[SIDL_MAX_ARRAY_DIMENSION],
 
1515
          stride[SIDL_MAX_ARRAY_DIMENSION];
 
1516
        if (sidl_array__extract_python_info
 
1517
          (pya, &dimen, lower, upper, stride))
 
1518
        {
 
1519
            *sidlarray = (struct                                              \
 
1520
              sidl_BaseClass__array*)sidl_interface__array_createRow
 
1521
            (dimen, lower, upper);
 
1522
          result = sidl_array__convert_python
 
1523
            (pya, dimen, *sidlarray, _convertPython);
 
1524
          if (*sidlarray && !result) {
 
1525
            sidl_interface__array_deleteRef(
 
1526
              (struct  sidl_interface__array *)*sidlarray);
 
1527
            *sidlarray = NULL;
 
1528
          }
 
1529
        }
 
1530
      }
 
1531
      Py_DECREF(pya);
 
1532
    }
 
1533
  }
 
1534
  return result;
 
1535
}
 
1536
 
 
1537
static int
 
1538
_convertSIDL(void *sidlarray, const int *ind, PyObject **dest)
 
1539
{
 
1540
  struct sidl_BaseClass__object *sidlobj = (struct sidl_BaseClass__object*)
 
1541
  sidl_interface__array_get((struct sidl_interface__array *)
 
1542
    sidlarray, ind);
 
1543
  *dest = sidl_BaseClass__wrap(sidlobj);
 
1544
  return (*dest == NULL);
 
1545
}
 
1546
 
 
1547
sidl_BaseClass__convert_sidl_array_RETURN
 
1548
sidl_BaseClass__convert_sidl_array sidl_BaseClass__convert_sidl_array_PROTO {
 
1549
  PyObject *pya = NULL;
 
1550
  if (sidlarray) {
 
1551
    const int dimen = sidlArrayDim(sidlarray);
 
1552
    int numelem[7];
 
1553
    int32_t start[7];
 
1554
#if SIZEOF_INT != 4
 
1555
    int lower[7];
 
1556
    int upper[7];
 
1557
    int32_t s_numelem[7];
 
1558
#else
 
1559
    int * const lower = (int *)(sidlarray->d_lower);
 
1560
    int * const upper = (int *)(sidlarray->d_upper);
 
1561
    int32_t * const s_numelem = numelem;
 
1562
#endif
 
1563
    int i;
 
1564
    for(i = 0; i < dimen; ++i) {
 
1565
      start[i] = sidlLower(sidlarray, i);
 
1566
#if SIZEOF_INT != 4
 
1567
      lower[i] = sidlLower(sidlarray, i);
 
1568
      upper[i] = sidlUpper(sidlarray, i);
 
1569
      s_numelem[i] = sidlLength(sidlarray, i);
 
1570
#endif
 
1571
      numelem[i] = 1 + upper[i] - lower[i];
 
1572
    }
 
1573
    pya = PyArray_FromDims(dimen, numelem, PyArray_OBJECT);
 
1574
    if (pya) {
 
1575
      if (!sidl_array__convert_sidl(pya, dimen, start,
 
1576
        sidlarray->d_upper,
 
1577
        s_numelem, sidlarray, _convertSIDL))
 
1578
      {
 
1579
        Py_DECREF(pya);
 
1580
        pya = NULL;
 
1581
      }
 
1582
    }
 
1583
  }
 
1584
  else {
 
1585
    Py_INCREF(Py_None);
 
1586
    pya = Py_None;
 
1587
  }
 
1588
  return pya;
 
1589
}
 
1590
 
 
1591
void
 
1592
initBaseClass(void) {
 
1593
  PyObject *module, *dict, *c_api;
 
1594
  static void *ExternalAPI[sidl_BaseClass__API_NUM];
 
1595
  struct sidl_BaseInterface__object *throwaway_exception;
 
1596
  module = Py_InitModule3("BaseClass", _BaseClassModuleMethods, "\
 
1597
\
 
1598
Every class implicitly inherits from <code>BaseClass</code>.  This\n\
 
1599
class implements the methods in <code>BaseInterface</code>."
 
1600
  );
 
1601
  dict = PyModule_GetDict(module);
 
1602
  ExternalAPI[sidl_BaseClass__wrap_NUM] = (void*)sidl_BaseClass__wrap;
 
1603
  ExternalAPI[sidl_BaseClass__convert_NUM] = (void*)sidl_BaseClass__convert;
 
1604
  ExternalAPI[sidl_BaseClass__convert_python_array_NUM] = (                   \
 
1605
    void*)sidl_BaseClass__convert_python_array;
 
1606
  ExternalAPI[sidl_BaseClass__convert_sidl_array_NUM] = (                     \
 
1607
    void*)sidl_BaseClass__convert_sidl_array;
 
1608
  ExternalAPI[sidl_BaseClass__weakRef_NUM] = (void*)sidl_BaseClass__weakRef;
 
1609
  ExternalAPI[sidl_BaseClass_deref_NUM] = (void*)sidl_BaseClass_deref;
 
1610
  ExternalAPI[sidl_BaseClass__newRef_NUM] = (void*)sidl_BaseClass__newRef;
 
1611
  ExternalAPI[sidl_BaseClass__addRef_NUM] = (void*)sidl_BaseClass__addRef;
 
1612
  ExternalAPI[sidl_BaseClass_PyType_NUM] = (void*)sidl_BaseClass_PyType;
 
1613
#ifdef WITH_RMI
 
1614
  ExternalAPI[sidl_BaseClass__connectI_NUM] = (void*)sidl_BaseClass__connectI;
 
1615
#endif /*WITH_RMI*/
 
1616
  import_SIDLObjA();
 
1617
  if (PyErr_Occurred()) {
 
1618
    Py_FatalError("Error importing sidlObjA module.");
 
1619
  }
 
1620
  c_api = PyCObject_FromVoidPtr((void *)ExternalAPI, NULL);
 
1621
  PyDict_SetItemString(dict, "_C_API", c_api);
 
1622
  Py_XDECREF(c_api);
 
1623
  import_SIDLPyArrays();
 
1624
  if (PyErr_Occurred()) {
 
1625
    Py_FatalError("Error importing sidlPyArrays module.");
 
1626
  }
 
1627
  import_array();
 
1628
  if (PyErr_Occurred()) {
 
1629
    Py_FatalError("Error importing Numeric Python module.");
 
1630
  }
 
1631
  sidl_BaseInterface__import();
 
1632
  _sidl_BaseClassType.tp_base = sidl_BaseInterface_PyType();
 
1633
  _sidl_BaseClassType.tp_bases = PyTuple_New(1);
 
1634
  PyTuple_SetItem(_sidl_BaseClassType.tp_bases,0, (PyObject                   \
 
1635
    *)sidl_BaseInterface_PyType());
 
1636
  if (PyType_Ready(&_sidl_BaseClassType) < 0) {
 
1637
    PyErr_Print();
 
1638
    fprintf(stderr, "PyType_Ready on sidl.BaseClass failed.\n");
 
1639
    return;
 
1640
  }
 
1641
  Py_INCREF(&_sidl_BaseClassType);
 
1642
  PyDict_SetItemString(dict, "BaseClass", (PyObject *)&_sidl_BaseClassType);
 
1643
  _implEPV = sidl_BaseClass__externals();
 
1644
  if (!_implEPV) {
 
1645
    Py_FatalError("Cannot load implementation for sidl class sidl.BaseClass");
 
1646
  }
 
1647
 
 
1648
#ifdef WITH_RMI
 
1649
 
 
1650
 
 
1651
  sidl_rmi_ConnectRegistry_registerConnect("sidl.BaseClass", (                \
 
1652
    void*)sidl_BaseClass__IHConnect, &throwaway_exception);
 
1653
 
 
1654
#endif /*WITH_RMI*/
 
1655
 
 
1656
}