Top   Types   Functions   Classes   Options   Index   Sources 

erwin/classdef.h


  1  /* -*- Mode: C -*- */
  2  
  3  /*
  4   * Author:      Henrik Theiling
  5   * Description: Extended C++ programming, definition file.
  6   *
  7   * @@Begin: Licencing and Copying@@
  8   *
  9   * Copyright (c) Henrik Theiling
 10   * Licence Version 2, Special Version for Erwin.
 11   *
 12   * The term 'this software' used in the following, additional to its
 13   * usual usage, also includes the instantiated source files generated by
 14   * tools of this package.
 15   *
 16   * This software is provided 'as-is', without warranty of any kind,
 17   * express or implied.  In no event will the authors or copyright holders
 18   * be held liable for any damages arising from the use of this software.
 19   *
 20   * Permission is granted to anyone to use this software for any purpose,
 21   * including commercial applications, and to alter it and redistribute it
 22   * freely, subject to the following restrictions:
 23   *
 24   * 1. The origin of this software must not be misrepresented; you must
 25   * not claim that you wrote the original software. If you use this
 26   * software in a product, an acknowledgment in the product documentation
 27   * would be appreciated.
 28   *
 29   * 2. Altered source versions must be plainly marked as such, and must
 30   * not be misrepresented as being the original software.
 31   *
 32   * 3. You must not use any of the names of the authors or copyright
 33   * holders of the original software for advertising or publicity
 34   * pertaining to distribution without specific, written prior permission.
 35   *
 36   * 4. If you change this software and redistribute parts or all of it in
 37   * any form, you must make the source code of the altered version of this
 38   * software available.  As an exception, files that were generated by
 39   * tools of this package may be used freely, including modification.
 40   *
 41   * 5. This notice must not be removed or altered from any source
 42   * distribution.
 43   *
 44   * This licence is governed by the Laws of Germany.  Disputes shall be
 45   * settled by Saarbruecken City Court.
 46   *
 47   * @@End: Licencing and Copying@@
 48   */
 49  
 50  #ifndef Global_ERWIN_CLASSDEF_H
 51  #define Global_ERWIN_CLASSDEF_H
 52  
 53  #ifdef Global_ERWIN_COMPILING
 54  #  include "--INCPREF2B--erwin/defs.h"
 55  #else
 56  #  include <--INCPREF2B--erwin/defs.h>
 57  #endif
 58  
 59  /* Configuration options: */
 60  
 61  /* ********************************************************************** */
 62  /* #define Global_ERWIN_CLASS_REFCOUNT 1 */
 63  /*
 64   * Whether you want reference counting to be used by the macros
 65   * 'abstract' and 'concrete'.
 66   */
 67  #define ?Global_ERWIN_CLASS_REFCOUNT 1
 68  
 69  /* ********************************************************************** */
 70  /* #define Global_ERWIN_CLASS_REFCOUNT_FAKE 0 */
 71  /*
 72   * Whether you want reference counting interface despite the fact that
 73   * no refcounting in used.  This may be good to keep an existing interface
 74   * intact instead of removing some functions and macros.
 75   */
 76  #define ?Global_ERWIN_CLASS_REFCOUNT_FAKE 0
 77  
 78  /* ********************************************************************** */
 79  /* #define Global_ERWIN_CLASS_ID 1 */
 80  /*
 81   * Whether you want unique class ids (via member function klass_id()).
 82   */
 83  #define ?Global_ERWIN_CLASS_ID 1
 84  
 85  /* ********************************************************************** */
 86  /* #define Global_ERWIN_CLASS_USE_CGEN 1 */
 87  /*
 88   * Whether erwin-cgen is used to generate the member functions in this
 89   * file.  Otherwise, inline versions are used.  This slows down compilation,
 90   * but the resulting program usually executes faster.
 91   *
 92   * Note that some features that erwin-cgen provides cannot be emulated with
 93   * inline functions.  Notable the default result of the types of slots is not
 94   * available in macros, so the macros may fail while the erwin-cgen generated
 95   * stuff works and returns a default value (if desired).
 96   */
 97  #define ?Global_ERWIN_CLASS_USE_CGEN 1
 98  
 99  #ifdef Global_ERWIN_COMPILING
100  #  include "--INCPREF2B--erwin/newdelete.h"
101  #else
102  #  include <--INCPREF2B--erwin/newdelete.h>
103  #endif
104  
105  
106  /*
107   * Access macros:
108   *
109   * For hiding the implementation from the user, we use access
110   * functions for every data field of a struct.  This allows
111   * changing the internal representation (e.g. from inline to
112   * allocated pointer) without changing the user interface.
113   *
114   * The member itself is declared 'private: ... _m_test;'.  The
115   * access function the library should use is called m_test().
116   * Apart from the constructor, never assign values to _m_test directly,
117   * this prevents debugging.
118   *
119   * Reading a member 'test' works by invoking the member function 'test()',
120   * if the slot is readable.
121   * Writing works using the 'set_test(...)' method if the slow is writable.
122   * For writable non-reference things, a special wrapper is called
123   * 'reset_test()' which is equivalent to 'set_test(0)'.
124   *
125   * If the access mechanism does not suite your type, declare the
126   * member _priv and provide own access functions.
127   *
128   * Part 1: Kind of member (Global_child_, Global_xref_)
129   *
130   *    There are two types of storage classes:
131   *        child: children
132   *        xref:  cross references
133   *    Children are deallocated when the parent is deleted.  This means
134   *    that not only the reference counter is decremented, but that the
135   *    child is explicitly deleted.  All scalar types and inlines
136   *    structs are also counted as children.
137   *
138   *    Cross references only exist for pointers.  When a parent is
139   *    deleted, only the reference counter of the cross reference is
140   *    decremented.
141   *
142   *    Note that Erwin structures are always children even though their
143   *    respective children are usually xrefs.
144   *
145   * Part 2: Access protection
146   *    This decides whether the user can read and/or write the member
147   *    data.  There are the following types:
148   *
149   *         priv: the thing is private:
150   *               No access functions are defined.  This can also be
151   *               used if want to provide your own functions.
152   *
153   *         ro:  read-only
154   *
155   *              No writer function will be implemented.  This can
156   *              also be used if you want to provide your own writer.
157   *
158   *         rw:  read-write
159   *
160   *              Public reader and writer functions are implemented.
161   *
162   *         ri:  read, write-inheriting
163   *              This is for inlined structs and pointers only: if
164   *              the object is const, the pointer is const, too.
165   *              the the object is writable, so is the pointer.
166   *
167   *              Note that this sometimes creates problems with an
168   *              operator= and the copy constructor when using
169   *              pointers, since the argument to these methods is
170   *              const, so you don't get a non-const pointer if you
171   *              export is write-inheriting.  For copied child, it
172   *              works fine, though.
173   *
174   *         rp:  Readable but write-protected
175   *
176   *              Like rw, but the writer is protected, so although
177   *              the user has no access, the class has write access
178   *              (including automatic REF/UNREF for _obj slots).
179   *
180   *
181   * Part 3: Type of storage in object:
182   *     There are the following types:
183   *         <empty>    normal data: use for scalars like int, bool,
184   *                    symbol, etc.  Members of this kind must
185   *                    understand an assignment from 0.
186   *
187   *         _ref       an inlined object/struct: C++ handles copying.
188   *                    This declares the member like a scalar, but
189   *                    the user interface has pointers so that you
190   *                    can change the type to _ptr or _obj later.
191   *
192   *         _eref      an inlined object/struct: C++ handles copying.
193   *                    In contrast to _ref, this generates a reference
194   *                    interface in C++.  Usually this is deprecated,
195   *                    use _ref instead.  But of course there may be
196   *                    cases where the _eref interface is just natural
197   *                    and you do want to use it.  Note that the
198   *                    C interface will still use pointers.
199   *
200   *         _obj       a pointer to a class in the GlobalUCFirst_Object class
201   *                    hierarchy.  The objects are automatically
202   *                    ref'ed and unref'ed by the set_... method.
203   *                    Specify the type without the trailing *.
204   *
205   *         _ptr       a foreign pointer, i.e. one that is not from
206   *                    the GlobalUCFirst_Object class hierarchy.  Use for
207   *                    objects that do not support the ->ref(),
208   *                    ->unref() methods.
209   *                    Specify the type without the trailing *.
210   *
211   *
212   * Note that for _obj and _ptr, the object itself is still writable,
213   * only the pointer in the internal structure is not.
214   *
215   * Theoretically, we could generate a good amount of code for
216   * constructors and destructors from all this information, but
217   * we currently don't.
218   *
219   * For xref, only _ptr and _obj is available.
220   *
221   * For child, Global_child_rw_ptr is not supported, because we cannot handle
222   * children of *some* type automatically.  Declare it _ro_ptr and
223   * provide set_ methods yourself.
224   */
225  
226  /*
227   * All the macros end with visibility 'public' (and never depend on any
228   * visibility themselves).
229   */
230  
231  /* Totally private: */
232  #define _Global_member_priv(TYPE, NAME, DOCSTRING) \
233          private:                                   \
234              TYPE _m_##NAME;                        \
235          protected:                                 \
236              TYPE &m_##NAME();                      \
237              TYPE const &m_##NAME() const;          \
238          public:
239  
240  #define _Global_member_priv_ref(TYPE, NAME, DOCSTRING) \
241          _Global_member_priv    (TYPE, NAME, DOCSTRING)
242  
243  #define _Global_member_priv_eref(TYPE, NAME, DOCSTRING) \
244          _Global_member_priv     (TYPE, NAME, DOCSTRING)
245  
246  #define _Global_member_priv_ptr(TYPE,   NAME, DOCSTRING) \
247          _Global_member_priv    (TYPE *, NAME, DOCSTRING)
248  
249  #define _Global_member_priv_obj(TYPE, NAME, DOCSTRING) \
250          private:                                       \
251              TYPE *_m_##NAME;                           \
252          protected:                                     \
253              TYPE *&m_##NAME();                         \
254              TYPE *const &m_##NAME() const;             \
255          public:
256  
257  /* Read-only inheriting pointer: */
258  #define _Global_member_ri_ptr(TYPE, NAME, DOCSTRING)        \
259              _Global_member_priv_ptr (TYPE, NAME, DOCSTRING) \
260              TYPE *NAME();                                   \
261              TYPE const *NAME() const;
262  
263  #define _Global_member_ri_obj(TYPE, NAME, DOCSTRING)        \
264              _Global_member_priv_obj (TYPE, NAME, DOCSTRING) \
265              TYPE *NAME();                                   \
266              TYPE const *NAME() const;
267  
268  /* Read-only inheriting reference: */
269  #define _Global_member_ri_ref(TYPE, NAME, DOCSTRING)        \
270              _Global_member_priv_ref (TYPE, NAME, DOCSTRING) \
271              TYPE *NAME();                                   \
272              TYPE const *NAME() const;
273  
274  #define _Global_member_ri_eref(TYPE, NAME, DOCSTRING)        \
275              _Global_member_priv_eref (TYPE, NAME, DOCSTRING) \
276              TYPE &NAME();                                    \
277              TYPE const &NAME() const;
278  
279  /* Read-only member: */
280  #define _Global_member_ro(TYPE, NAME, DOCSTRING)        \
281              _Global_member_priv (TYPE, NAME, DOCSTRING) \
282              TYPE NAME() const;
283  
284  /* Read-only member that is returned by reference:
285   * Note that this returns a pointer no matter what.  This allows changing this
286   * to _ri_ptr and even _ro_ptr without a significant change in the interface.
287   */
288  #define _Global_member_ro_ref(TYPE, NAME, DOCSTRING)        \
289              _Global_member_priv_ref (TYPE, NAME, DOCSTRING) \
290              TYPE const *NAME() const;
291  
292  
293  #define _Global_member_ro_eref(TYPE, NAME, DOCSTRING)        \
294              _Global_member_priv_eref (TYPE, NAME, DOCSTRING) \
295              TYPE const &NAME() const;
296  
297  /* Read-only member that is returned by reference: */
298  #define _Global_member_ro_ptr(TYPE, NAME, DOCSTRING)        \
299              _Global_member_priv_ptr (TYPE, NAME, DOCSTRING) \
300              TYPE *NAME() const;
301  
302  #define _Global_member_ro_obj(TYPE, NAME, DOCSTRING)         \
303              _Global_member_priv_obj (TYPE, NAME, DOCSTRING)  \
304              TYPE *NAME() const;
305  
306  /* Read/Write member (these are by reference only): */
307  #define _Global_member_rw(TYPE, NAME, DOCSTRING)        \
308              _Global_member_priv (TYPE, NAME, DOCSTRING) \
309              TYPE NAME() const;       \
310              void set_##NAME (TYPE a);
311  
312  #define _Global_member_rw_ref(TYPE, NAME, DOCSTRING)        \
313              _Global_member_priv_ref (TYPE, NAME, DOCSTRING) \
314              TYPE *NAME();                                \
315              TYPE const *NAME() const;                    \
316              void set_##NAME (TYPE const *a);
317  
318  #define _Global_member_rw_eref(TYPE, NAME, DOCSTRING)        \
319              _Global_member_priv_eref (TYPE, NAME, DOCSTRING) \
320              TYPE &NAME();                                    \
321              TYPE const &NAME() const;                        \
322              void set_##NAME (TYPE const &a);
323  
324  #define _Global_member_rw_ptr(TYPE, NAME, DOCSTRING)        \
325              _Global_member_priv_ptr (TYPE, NAME, DOCSTRING) \
326              TYPE *NAME() const;                          \
327              void set_##NAME (TYPE *a);                   \
328              void reset_##NAME ();
329  
330  #define _Global_member_rw_obj(TYPE, NAME, DOCSTRING)        \
331              _Global_member_priv_obj (TYPE, NAME, DOCSTRING) \
332              TYPE *NAME() const;                          \
333              void set_##NAME (TYPE *a);                   \
334              void reset_##NAME ();
335  
336  /* Read/Protected Write member (these are by reference only): */
337  #define _Global_member_rp(TYPE, NAME, DOCSTRING)        \
338              _Global_member_priv (TYPE, NAME, DOCSTRING) \
339              TYPE NAME() const;                          \
340          protected:                                      \
341              void set_##NAME (TYPE a);                   \
342          public:
343  
344  #define _Global_member_rp_ref(TYPE, NAME, DOCSTRING)        \
345              _Global_member_priv_ref (TYPE, NAME, DOCSTRING) \
346              TYPE const *NAME() const;                       \
347          protected:                                          \
348              TYPE *NAME();                                   \
349              void set_##NAME (TYPE const *a);                \
350          public:
351  
352  #define _Global_member_rp_eref(TYPE, NAME, DOCSTRING)        \
353              _Global_member_priv_eref (TYPE, NAME, DOCSTRING) \
354              TYPE const &NAME() const;                        \
355          protected:                                           \
356              TYPE &NAME();                                    \
357              void set_##NAME (TYPE const &a);                 \
358          public:
359  
360  #define _Global_member_rp_ptr(TYPE, NAME, DOCSTRING)        \
361              _Global_member_priv_ptr (TYPE, NAME, DOCSTRING) \
362              TYPE *NAME() const;                             \
363          protected:                                          \
364              void set_##NAME (TYPE *a);                      \
365              void reset_##NAME ();                           \
366          public:
367  
368  #define _Global_member_rp_obj(TYPE, NAME, DOCSTRING)        \
369              _Global_member_priv_obj (TYPE, NAME, DOCSTRING) \
370              TYPE *NAME() const;                             \
371          protected:                                          \
372              void set_##NAME (TYPE *a);                      \
373              void reset_##NAME ();                           \
374          public:
375  
376  
377  /*
378   * We distinguish three types of data fields:
379   *    data    - non-pointer object, C++ handles automatic deallocation
380   *    child   - pointer to an object that is part of the given structure: if the structure
381   *              is deallocated, all its objects are deallocated, too.
382   *    xref    - like a pointer, but will not be deallocated.
383   *
384   */
385  
386  /* CAUTION: WHEN YOU CHANGE THESE, ADJUST THE PERL SCRIPT THAT GENERATES
387   *          THE C INTERFACE! */
388  
389  #define Global_child_priv(TYPE, NAME, DOCSTRING)      _Global_member_priv      (TYPE, NAME, DOCSTRING)
390  #define Global_child_priv_ref(TYPE, NAME, DOCSTRING)  _Global_member_priv_ref  (TYPE, NAME, DOCSTRING)
391  #define Global_child_priv_eref(TYPE, NAME, DOCSTRING) _Global_member_priv_eref (TYPE, NAME, DOCSTRING)
392  #define Global_child_priv_ptr(TYPE, NAME, DOCSTRING)  _Global_member_priv_ptr  (TYPE, NAME, DOCSTRING)
393  #define Global_child_priv_obj(TYPE, NAME, DOCSTRING)  _Global_member_priv_obj  (TYPE, NAME, DOCSTRING)
394  #define Global_child_ri_obj(TYPE, NAME, DOCSTRING)    _Global_member_ri_obj    (TYPE, NAME, DOCSTRING)
395  #define Global_child_ri_ptr(TYPE, NAME, DOCSTRING)    _Global_member_ri_ptr    (TYPE, NAME, DOCSTRING)
396  #define Global_child_ri_ref(TYPE, NAME, DOCSTRING)    _Global_member_ri_ref    (TYPE, NAME, DOCSTRING)
397  #define Global_child_ri_eref(TYPE, NAME, DOCSTRING)   _Global_member_ri_eref   (TYPE, NAME, DOCSTRING)
398  #define Global_child_ro(TYPE, NAME, DOCSTRING)        _Global_member_ro        (TYPE, NAME, DOCSTRING)
399  #define Global_child_ro_obj(TYPE, NAME, DOCSTRING)    _Global_member_ro_obj    (TYPE, NAME, DOCSTRING)
400  #define Global_child_ro_ptr(TYPE, NAME, DOCSTRING)    _Global_member_ro_ptr    (TYPE, NAME, DOCSTRING)
401  #define Global_child_ro_ref(TYPE, NAME, DOCSTRING)    _Global_member_ro_ref    (TYPE, NAME, DOCSTRING)
402  #define Global_child_ro_eref(TYPE, NAME, DOCSTRING)   _Global_member_ro_eref   (TYPE, NAME, DOCSTRING)
403  #define Global_child_rw(TYPE, NAME, DOCSTRING)        _Global_member_rw        (TYPE, NAME, DOCSTRING)
404  #define Global_child_rw_obj(TYPE, NAME, DOCSTRING)    _Global_member_rw_obj    (TYPE, NAME, DOCSTRING)
405  #define Global_child_rw_ptr(TYPE, NAME, DOCSTRING)    _Global_member_rw_ptr    (TYPE, NAME, DOCSTRING)
406  #define Global_child_rw_ref(TYPE, NAME, DOCSTRING)    _Global_member_rw_ref    (TYPE, NAME, DOCSTRING)
407  #define Global_child_rw_eref(TYPE, NAME, DOCSTRING)   _Global_member_rw_eref   (TYPE, NAME, DOCSTRING)
408  #define Global_child_rp(TYPE, NAME, DOCSTRING)        _Global_member_rp        (TYPE, NAME, DOCSTRING)
409  #define Global_child_rp_obj(TYPE, NAME, DOCSTRING)    _Global_member_rp_obj    (TYPE, NAME, DOCSTRING)
410  #define Global_child_rp_ptr(TYPE, NAME, DOCSTRING)    _Global_member_rp_ptr    (TYPE, NAME, DOCSTRING)
411  #define Global_child_rp_ref(TYPE, NAME, DOCSTRING)    _Global_member_rp_ref    (TYPE, NAME, DOCSTRING)
412  #define Global_child_rp_eref(TYPE, NAME, DOCSTRING)   _Global_member_rp_eref   (TYPE, NAME, DOCSTRING)
413  
414  #define Global_xref_priv_obj(TYPE, NAME, DOCSTRING)   _Global_member_priv_obj  (TYPE, NAME, DOCSTRING)
415  #define Global_xref_priv_ptr(TYPE, NAME, DOCSTRING)   _Global_member_priv_ptr  (TYPE, NAME, DOCSTRING)
416  #define Global_xref_ri_obj(TYPE, NAME, DOCSTRING)     _Global_member_ri_obj    (TYPE, NAME, DOCSTRING)
417  #define Global_xref_ri_ptr(TYPE, NAME, DOCSTRING)     _Global_member_ri_ptr    (TYPE, NAME, DOCSTRING)
418  #define Global_xref_ro_obj(TYPE, NAME, DOCSTRING)     _Global_member_ro_obj    (TYPE, NAME, DOCSTRING)
419  #define Global_xref_ro_ptr(TYPE, NAME, DOCSTRING)     _Global_member_ro_ptr    (TYPE, NAME, DOCSTRING)
420  #define Global_xref_rw_obj(TYPE, NAME, DOCSTRING)     _Global_member_rw_obj    (TYPE, NAME, DOCSTRING)
421  #define Global_xref_rw_ptr(TYPE, NAME, DOCSTRING)     _Global_member_rw_ptr    (TYPE, NAME, DOCSTRING)
422  #define Global_xref_rp_obj(TYPE, NAME, DOCSTRING)     _Global_member_rp_obj    (TYPE, NAME, DOCSTRING)
423  #define Global_xref_rp_ptr(TYPE, NAME, DOCSTRING)     _Global_member_rp_ptr    (TYPE, NAME, DOCSTRING)
424  
425  #define Global_foreign_class(TYPE_CXX)--WITH-GLOBAL--                              \
426  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (GlobalUCFirst_, TYPE_CXX) TYPE_CXX;
427  
428  #define Global_foreign_type(TYPE_C)--WITH-GLOBAL--                      \
429  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_C;
430  
431  #define Global_local_class(TYPE_CXX)--WITH-GLOBAL--                                \
432  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (GlobalUCFirst_, TYPE_CXX) TYPE_CXX;
433  
434  #define Global_local_type(TYPE_C, TYPE_CXX)--WITH-GLOBAL--                \
435  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_C;   \
436  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_CXX;
437  
438  #define Global_local_enum(TYPE_C, TYPE_CXX)--WITH-GLOBAL--                \
439  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_C;   \
440  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_CXX;
441  
442  #define Global_local_union(TYPE_C, TYPE_CXX)--WITH-GLOBAL--               \
443  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_C;   \
444  --WITH-GLOBAL--   typedef ERWIN_CONCAT_TOKEN (Global_, TYPE_C) TYPE_CXX;
445  
446  
447  #if ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_REFCOUNT)
448  #  define Global_stdclass_refcount                                                   \
449          THIS const *_ref() const                                                     \
450              { return ((THIS const *)((Object const *)(this))->_ref()); }             \
451          THIS *_ref()                                                                 \
452              { return ((THIS *)((Object *)(this))->_ref()); }                         \
453          THIS const *_unref() const                                                   \
454              { return ((THIS const *)((Object const *)(this))->_unref()); }           \
455          THIS *_unref()                                                               \
456              { return ((THIS *)((Object *)(this))->_unref()); }                       \
457          THIS const *_ref_unref() const                                               \
458              { return ((THIS const *)((Object const *)(this))->_ref_unref()); }       \
459          THIS *_ref_unref()                                                           \
460              { return ((THIS *)((Object *)(this))->_ref_unref()); }                   \
461          THIS const *_unref_no_delete() const                                         \
462              { return ((THIS const *)((Object const *)(this))->_unref_no_delete()); } \
463          THIS *_unref_no_delete()                                                     \
464              { return ((THIS *)((Object *)(this))->_unref_no_delete()); }
465  #elif ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_REFCOUNT_FAKE)
466  #  define Global_stdclass_refcount                             \
467          THIS const *_ref() const              { return this; } \
468          THIS *_ref()                          { return this; } \
469          THIS const *_unref() const            { return this; } \
470          THIS *_unref()                        { return this; } \
471          THIS const *_ref_unref() const        { return this; } \
472          THIS *_ref_unref()                    { return this; } \
473          THIS const *_unref_no_delete() const  { return this; } \
474          THIS *_unref_no_delete()              { return this; }
475  #else
476  #  define Global_stdclass_refcount
477  #endif
478  
479  #define Global_stdclass_no_ref                             \
480      public:                                                \
481          typedef THIS This;                                 \
482          typedef SUPER Super;                               \
483      protected:                                             \
484          virtual THIS *ERWIN_CONCAT_TOKEN(v_as_, THIS) (); \
485      public:
486  
487  #define Global_stdclass                                    \
488          Global_stdclass_no_ref                             \
489      public:                                                \
490          Global_stdclass_refcount
491  
492  #ifndef Global_SET_ID
493  #define Global_SET_ID(X) do{;}while(0)
494  #endif
495  
496  #if ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_ID)
497  #  define Global_concrete_id                                                                   \
498      private:                                                                                   \
499          void set_id() { Global_SET_ID(ERWIN_CONCAT_TOKEN(Global_id_, THIS)); }                \
500      protected:                                                                                 \
501          virtual class_id_t  v_klass_id() const { return ERWIN_CONCAT_TOKEN(Global_id_,THIS);}
502  #else
503  #  define Global_concrete_id
504  #endif
505  
506  #define Global_concrete                                                      \
507          Global_stdclass                                                      \
508      private:                                                                 \
509          virtual void _concrete () const { }                                  \
510      protected:                                                               \
511          virtual char const *v_klass_name() const { return ERWIN_STR(THIS); } \
512          Global_concrete_id                                                   \
513      public:
514  
515  
516  #if ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_ID)
517  #  define Global_abstract_id                          \
518      protected:                                        \
519          virtual class_id_t  v_klass_id() const   = 0;
520  #else
521  #  define Global_abstract_id
522  #endif
523  
524  
525  #define Global_abstract                               \
526          Global_stdclass                               \
527      private:                                          \
528          virtual void _concrete () const = 0;          \
529      protected:                                        \
530          virtual char const *v_klass_name() const = 0; \
531          Global_abstract_id                            \
532      public:
533  
534  
535  #define Global_abstract_no_ref                        \
536          Global_stdclass_no_ref                        \
537      private:                                          \
538          virtual void _concrete () const = 0;          \
539      protected:                                        \
540          virtual char const *v_klass_name() const = 0; \
541          Global_abstract_id                            \
542      public:
543  
544  
545  #if ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_ID)
546  #  define Global_general_object_id                                   \
547      protected:                                                       \
548          virtual class_id_t klass_id() const                          \
549              { return this == NULL ? Global_id_NULL : v_klass_id(); }
550  #else
551  #  define Global_general_object_id
552  #endif
553  
554  
555  #define Global_general_object                                                           \
556          typedef Object This;                                                            \
557          announce_class(Object)                                                          \
558      private:                                                                            \
559          virtual void _concrete () const = 0;                                            \
560      protected:                                                                          \
561          virtual char const *v_klass_name() const = 0;                                   \
562          Global_abstract_id                                                              \
563      public:                                                                             \
564          char const *klass_name() const { return this == NULL ? NULL : v_klass_name(); } \
565          Global_general_object_id
566  
567  
568  #define Global_make_cast(TYPE)            \
569      public:                               \
570          TYPE *cast_##TYPE ();             \
571          TYPE const *cast_##TYPE () const;
572  
573  #define Global_announce_class(TYPE)     \
574      protected:                          \
575          virtual TYPE *v_as_##TYPE();    \
576          Global_make_cast(TYPE)          \
577      public:                             \
578          TYPE *as_##TYPE ();             \
579          TYPE const *as_##TYPE () const;
580  
581  
582  /* The following ones are used to have make-wrap-c.pl generate simple
583   * implementations for hidden, trivial, redirecting and inherited
584   * functions: */
585  #define Global_hidden    private
586  #define Global_trivial
587  #define Global_redirect
588  #define Global_inherit
589  
590  /* Prepend library prefix to THIS/SUPER: */
591  #undef  THIS
592  #undef  SUPER
593     /* Some Windows header defines THIS to 'void' */
594  
595  #define Global_THIS        ERWIN_CONCAT_TOKEN(GlobalUCFirst_, THIS)
596  #define Global_SUPER       ERWIN_CONCAT_TOKEN(GlobalUCFirst_, SUPER)
597  
598  #if !ERWIN_BOOL_VALUE(Global_ERWIN_CLASS_USE_CGEN)
599  /* The classundef file has the inline macros: */
600  #ifdef Global_ERWIN_COMPILING
601  #  include "--INCPREF2B--erwin/classundef.h"
602  #else
603  #  include <--INCPREF2B--erwin/classundef.h>
604  #endif
605  #endif
606  
607  #endif /* Global_ERWIN_CLASSDEF_H */
608  
609  /*
610   * Note: the following is outside the #ifdef protection for
611   * switching the aliases back on after including classundef.h:
612   */
613  
614  --WITH-GLOBAL--#define child_priv       Global_child_priv
615  --WITH-GLOBAL--#define child_priv_ref   Global_child_priv_ref
616  --WITH-GLOBAL--#define child_priv_eref  Global_child_priv_eref
617  --WITH-GLOBAL--#define child_priv_ptr   Global_child_priv_ptr
618  --WITH-GLOBAL--#define child_priv_obj   Global_child_priv_obj
619  --WITH-GLOBAL--#define child_ri_obj     Global_child_ri_obj
620  --WITH-GLOBAL--#define child_ri_ptr     Global_child_ri_ptr
621  --WITH-GLOBAL--#define child_ri_ref     Global_child_ri_ref
622  --WITH-GLOBAL--#define child_ri_eref    Global_child_ri_eref
623  --WITH-GLOBAL--#define child_ro         Global_child_ro
624  --WITH-GLOBAL--#define child_ro_obj     Global_child_ro_obj
625  --WITH-GLOBAL--#define child_ro_ptr     Global_child_ro_ptr
626  --WITH-GLOBAL--#define child_ro_ref     Global_child_ro_ref
627  --WITH-GLOBAL--#define child_ro_eref    Global_child_ro_eref
628  --WITH-GLOBAL--#define child_rw         Global_child_rw
629  --WITH-GLOBAL--#define child_rw_obj     Global_child_rw_obj
630  --WITH-GLOBAL--#define child_rw_ptr     Global_child_rw_ptr
631  --WITH-GLOBAL--#define child_rw_ref     Global_child_rw_ref
632  --WITH-GLOBAL--#define child_rw_eref    Global_child_rw_eref
633  --WITH-GLOBAL--#define child_rp         Global_child_rp
634  --WITH-GLOBAL--#define child_rp_obj     Global_child_rp_obj
635  --WITH-GLOBAL--#define child_rp_ptr     Global_child_rp_ptr
636  --WITH-GLOBAL--#define child_rp_ref     Global_child_rp_ref
637  --WITH-GLOBAL--#define child_rp_eref    Global_child_rp_eref
638  --WITH-GLOBAL--#define xref_priv_obj    Global_xref_priv_obj
639  --WITH-GLOBAL--#define xref_priv_ptr    Global_xref_priv_ptr
640  --WITH-GLOBAL--#define xref_ri_obj      Global_xref_ri_obj
641  --WITH-GLOBAL--#define xref_ri_ptr      Global_xref_ri_ptr
642  --WITH-GLOBAL--#define xref_ro_obj      Global_xref_ro_obj
643  --WITH-GLOBAL--#define xref_ro_ptr      Global_xref_ro_ptr
644  --WITH-GLOBAL--#define xref_rw_obj      Global_xref_rw_obj
645  --WITH-GLOBAL--#define xref_rw_ptr      Global_xref_rw_ptr
646  --WITH-GLOBAL--#define xref_rp_obj      Global_xref_rp_obj
647  --WITH-GLOBAL--#define xref_rp_ptr      Global_xref_rp_ptr
648  
649  --WITH-GLOBAL--#define stdclass         Global_stdclass
650  --WITH-GLOBAL--#define stdclass_no_ref  Global_stdclass_no_ref
651  --WITH-GLOBAL--#define concrete         Global_concrete
652  --WITH-GLOBAL--#define abstract         Global_abstract
653  --WITH-GLOBAL--#define abstract_no_ref  Global_abstract_no_ref
654  --WITH-GLOBAL--#define general_object   Global_general_object
655  
656  --WITH-GLOBAL--#define announce_class   Global_announce_class
657  
658  --WITH-GLOBAL--#define hidden           Global_hidden
659  --WITH-GLOBAL--#define trivial          Global_trivial
660  --WITH-GLOBAL--#define redirect         Global_redirect
661  --WITH-GLOBAL--#define inherit          Global_inherit
662  
663  --WITH-GLOBAL--#define foreign_class    Global_foreign_class
664  --WITH-GLOBAL--#define foreign_type     Global_foreign_type
665  --WITH-GLOBAL--#define local_class      Global_local_class
666  --WITH-GLOBAL--#define local_type       Global_local_type
667  --WITH-GLOBAL--#define local_enum       Global_local_enum
668  --WITH-GLOBAL--#define local_union      Global_local_union
669  
670  

Index

Stoppt die Vorratsdatenspeicherung
November 26th, 2007
Comments? Suggestions? Corrections? You can drop me a line.
zpentrabvagiktu@theiling.de
Schwerpunktpraxis