1#ifndef COIN_SOSUBEVENT_H
2#define COIN_SOSUBEVENT_H
36#include <Inventor/C/tidbits.h>
40#define SO_EVENT_HEADER() \
42 static SoType classTypeId; \
46 static void cleanupClass(void) { classTypeId STATIC_SOTYPE_INIT; }; \
47 static void * createInstance(void); \
49 static SoType getClassTypeId(void); \
50 virtual SoType getTypeId(void) const
52#define SO_EVENT_ABSTRACT_HEADER() \
54 static SoType classTypeId; \
58 static void cleanupClass(void) { classTypeId STATIC_SOTYPE_INIT; }; \
60 static SoType getClassTypeId(void); \
61 virtual SoType getTypeId(void) const
65#define SO_EVENT_ABSTRACT_SOURCE(_class_) \
71SoType _class_::getClassTypeId(void) { return _class_::classTypeId; } \
78SoType _class_::getTypeId(void) const { return _class_::classTypeId; } \
79SoType _class_::classTypeId STATIC_SOTYPE_INIT
81#define SO_EVENT_SOURCE(_class_) \
87SoType _class_::getClassTypeId(void) { return _class_::classTypeId; } \
94SoType _class_::getTypeId(void) const { return _class_::classTypeId; } \
99void * _class_::createInstance(void) { return new _class_; } \
100SoType _class_::classTypeId STATIC_SOTYPE_INIT
104#define SO_EVENT_INIT_ABSTRACT_CLASS(_class_, _parentclass_) \
107 assert(_class_::classTypeId == SoType::badType()); \
109 assert(_parentclass_::getClassTypeId() != SoType::badType()); \
111 _class_::classTypeId = \
112 SoType::createType(_parentclass_::getClassTypeId(), SO__QUOTE(_class_)); \
116 cc_coin_atexit(reinterpret_cast<coin_atexit_f *>(cleanupClass)); \
119#define SO_EVENT_INIT_CLASS(_class_, _parentclass_) \
122 assert(_class_::classTypeId == SoType::badType()); \
124 assert(_parentclass_::getClassTypeId() != SoType::badType()); \
126 _class_::classTypeId = \
127 SoType::createType(_parentclass_::getClassTypeId(), SO__QUOTE(_class_), _class_::createInstance); \
131 cc_coin_atexit(reinterpret_cast<coin_atexit_f *>(cleanupClass)); \