36#include <Inventor/nodes/SoSubNode.h>
37#include <Inventor/fields/SoSFNode.h>
38#include <Inventor/nodekits/SoNodekitCatalog.h>
39#include <Inventor/C/tidbits.h>
43#include <Inventor/nodekits/SoNodeKitListPart.h>
50#define PRIVATE_KIT_HEADER(_kitclass_) \
52 static const SoNodekitCatalog * getClassNodekitCatalog(void); \
53 virtual const SoNodekitCatalog * getNodekitCatalog(void) const; \
56 static const SoNodekitCatalog ** getClassNodekitCatalogPtr(void); \
59 static SoNodekitCatalog * classcatalog; \
60 static const SoNodekitCatalog ** parentcatalogptr; \
61 static void atexit_cleanupkit(void)
63#define SO_KIT_HEADER(_kitclass_) \
64 SO_NODE_HEADER(_kitclass_); \
65 PRIVATE_KIT_HEADER(_kitclass_)
67#define SO_KIT_ABSTRACT_HEADER(_kitclass_) \
68 SO_NODE_ABSTRACT_HEADER(_kitclass_); \
69 PRIVATE_KIT_HEADER(_kitclass_)
71#define SO_KIT_CATALOG_ENTRY_HEADER(_entry_) \
72protected: SoSFNode _entry_
75#define PRIVATE_KIT_SOURCE(_class_) \
76SoNodekitCatalog * _class_::classcatalog = NULL; \
77const SoNodekitCatalog ** _class_::parentcatalogptr = NULL; \
83const SoNodekitCatalog * \
84_class_::getClassNodekitCatalog(void) \
86 return _class_::classcatalog; \
93const SoNodekitCatalog * \
94_class_::getNodekitCatalog(void) const \
96 return _class_::classcatalog; \
103const SoNodekitCatalog ** \
104_class_::getClassNodekitCatalogPtr(void) \
106 return const_cast<const class SoNodekitCatalog **>(&_class_::classcatalog); \
110_class_::atexit_cleanupkit(void) \
112 delete _class_::classcatalog; \
113 _class_::classcatalog = NULL; \
114 _class_::parentcatalogptr = NULL; \
117#define SO_KIT_SOURCE(_class_) \
118SO_NODE_SOURCE(_class_) \
119PRIVATE_KIT_SOURCE(_class_)
121#define SO_KIT_ABSTRACT_SOURCE(_class_) \
122SO_NODE_ABSTRACT_SOURCE(_class_); \
123PRIVATE_KIT_SOURCE(_class_)
125#define SO_KIT_IS_FIRST_INSTANCE() \
126 SO_NODE_IS_FIRST_INSTANCE()
128#define SO_KIT_INIT_CLASS(_class_, _parentclass_, _parentname_) \
130 SO_NODE_INIT_CLASS(_class_, _parentclass_, _parentname_); \
131 _class_::parentcatalogptr = _parentclass_::getClassNodekitCatalogPtr(); \
134#define SO_KIT_INIT_ABSTRACT_CLASS(_class_, _parentclass_, _parentname_) \
136 SO_NODE_INIT_ABSTRACT_CLASS(_class_, _parentclass_, _parentname_); \
137 _class_::parentcatalogptr = _parentclass_::getClassNodekitCatalogPtr(); \
141#define SO_KIT_CONSTRUCTOR(_class_) \
143 SO_NODE_CONSTRUCTOR(_class_); \
144 SoBase::staticDataLock(); \
145 if (_class_::classcatalog == NULL) { \
146 SoType mytype = SoType::fromName(SO__QUOTE(_class_)); \
147 _class_::classcatalog = (*_class_::parentcatalogptr)->clone(mytype); \
148 cc_coin_atexit_static_internal(_class_::atexit_cleanupkit); \
150 SoBase::staticDataUnlock(); \
155#define SO_KIT_ADD_CATALOG_ENTRY(_part_, _partclass_, _isdefnull_ , _parent_, _sibling_, _ispublic_) \
157 classcatalog->addEntry(SO__QUOTE(_part_), \
158 SoType::fromName(SO__QUOTE(_partclass_)), \
159 SoType::fromName(SO__QUOTE(_partclass_)), \
161 SO__QUOTE(_parent_), \
162 SO__QUOTE(_sibling_), \
167 SO_NODE_ADD_FIELD(_part_,(NULL)); \
172#define SO_KIT_ADD_CATALOG_LIST_ENTRY(_part_, _containertype_, _isdefnull_, _parent_, _sibling_, _itemtype_, _ispublic_) \
174 classcatalog->addEntry(SO__QUOTE(_part_), \
175 SoNodeKitListPart::getClassTypeId(), \
176 SoNodeKitListPart::getClassTypeId(), \
178 SO__QUOTE(_parent_), \
179 SO__QUOTE(_sibling_), \
181 _containertype_::getClassTypeId(), \
182 _itemtype_::getClassTypeId(), \
184 SO_NODE_ADD_FIELD(_part_,(NULL)); \
189#define SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(_part_, _class_, _defaultclass_, _isdefnull_, _parent_, _sibling_, _ispublic_) \
191 classcatalog->addEntry(SO__QUOTE(_part_), \
192 _class_::getClassTypeId(), \
193 _defaultclass_::getClassTypeId(), \
195 SO__QUOTE(_parent_), \
196 SO__QUOTE(_sibling_), \
201 SO_NODE_ADD_FIELD(_part_,(NULL)); \
206#define SO_KIT_ADD_LIST_ITEM_TYPE(_part_, _listitemtype_) \
208 classcatalog->addListItemType(SO__QUOTE(_part_), \
209 _listitemtype_::getClassTypeId()); \
213#define SO_KIT_INIT_INSTANCE() \
214 this->createFieldList(); \
215 this->createDefaultParts()
217#define SO_KIT_ADD_FIELD(_fieldname_, _defvalue_) \
218 SO_NODE_ADD_FIELD(_fieldname_, _defvalue_)
221#define SO_KIT_ADD_EMPTY_MFIELD(_fieldname_) \
222 SO_NODE_ADD_EMPTY_MFIELD(_fieldname_)
224#define SO_KIT_DEFINE_ENUM_VALUE(_enumtype_, _enumvalue_) \
225 SO_NODE_DEFINE_ENUM_VALUE(_enumtype_, _enumvalue_)
227#define SO_KIT_SET_MF_ENUM_TYPE(_fieldname_, _enumtype_) \
228 SO_NODE_SET_MF_ENUM_TYPE(_fieldname_, _enumtype_)
230#define SO_KIT_SET_SF_ENUM_TYPE(_fieldname_, _enumtype_) \
231 SO_NODE_SET_SF_ENUM_TYPE(_fieldname_, _enumtype_)
233#define SO_KIT_CHANGE_ENTRY_TYPE(_part_, _newpartclassname_, _newdefaultpartclassname_) \
235 classcatalog->narrowTypes(SO__QUOTE(_part_), \
236 SoType::fromName(SO__QUOTE(_newpartclassname_)), \
237 SoType::fromName(SO__QUOTE(_newdefaultpartclassname_))); \
241#define SO_KIT_CHANGE_NULL_BY_DEFAULT(_part_, _newnullbydefault_) \
243 classcatalog->setNullByDefault(SO__QUOTE(_part_), _newnullbydefault_); \