00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_NODEKIT_CATALOG
00052 #define _SO_NODEKIT_CATALOG
00053
00054 #include <Inventor/misc/SoBasic.h>
00055 #include <Inventor/SbString.h>
00056 #include <Inventor/SoLists.h>
00057 #include <Inventor/SoType.h>
00058
00059 #define SO_CATALOG_NAME_NOT_FOUND -1
00060 #define SO_CATALOG_THIS_PART_NUM 0
00061
00062 #ifndef HIDDEN_FROM_DOC
00064 //
00065
00066
00067
00068
00069
00071 SoNodekitCatalogEntry {
00072 private:
00073 SbName name;
00074 SoType type;
00075
00076
00077 SoType defaultType;
00078
00079
00080 SbBool nullByDefault;
00081
00082
00083 SbBool leafPart;
00084
00085 SbName parentName;
00086 SbName rightSiblingName;
00087 SbBool listPart;
00088 SoType listContainerType;
00089 SoTypeList listItemTypes;
00090
00091 SbBool publicPart;
00092
00093 private:
00094
00095 SoNodekitCatalogEntry(const SbName &theName,
00096 SoType theType, SoType theDefaultType,
00097 SbBool theNullByDefault,
00098 const SbName &theParentName, const SbName &theRightSiblingName,
00099 SbBool theListPart, SoType theListContainerType,
00100 const SoTypeList &theListItemTypes,
00101 SbBool thePublicPart);
00102
00103
00104 SoNodekitCatalogEntry *clone() const;
00105 SoNodekitCatalogEntry *clone( SoType newType,
00106 SoType newDefaultType ) const;
00107
00108
00109 const SbName &getName() const { return name; };
00110 SoType getType() const { return type; };
00111 SoType getDefaultType() const { return defaultType; };
00112 SbBool isNullByDefault() const { return nullByDefault; };
00113 SbBool isLeaf() const { return leafPart; };
00114 const SbName &getParentName() const { return parentName; };
00115 const SbName &getRightSiblingName() const { return rightSiblingName; };
00116 SbBool isList() const { return listPart; };
00117 SoType getListContainerType() const {return listContainerType;};
00118 const SoTypeList &getListItemTypes() const { return listItemTypes; };
00119 SbBool isPublic() const { return publicPart; };
00120
00121
00122 void addListItemType( SoType typeToAdd );
00123
00124 void setNullByDefault( SbBool newNullByDefault )
00125 { nullByDefault = newNullByDefault; }
00126
00127
00128 void setPublic( SbBool newPublic ) { publicPart = newPublic; }
00129 void setLeaf( SbBool newLeafPart ) { leafPart = newLeafPart; }
00130 void setRightSiblingName( const SbName &newN ) { rightSiblingName = newN; }
00131
00132
00133 void setTypes( SoType newType, SoType newDefaultType )
00134 { type = newType; defaultType = newDefaultType; }
00135
00136
00137
00138 SbBool recursiveSearch( const SbName &nameToFind,
00139 SoTypeList *typesChecked) const;
00140
00141 void printCheck() const;
00142 };
00143 #endif // HIDDEN_FROM_DOC
00144
00188 class SoNodekitCatalog {
00189
00190 private:
00191
00195 static void initClass();
00196 static void exitClass();
00197
00198 public:
00199
00203 int getNumEntries() const { return numEntries; };
00204
00205
00206
00207 #ifdef DEBUG_NODEKITS
00208
00211 long getPartNumber( const SbName &theName ) const;
00212 #else
00213
00216 int getPartNumber( const SbName &theName ) const;
00217 #endif
00218
00221 const SbName &getName( int thePartNumber ) const;
00225 SoType getType( int thePartNumber ) const;
00229 SoType getType( const SbName &theName ) const;
00233 SoType getDefaultType( int thePartNumber ) const;
00237 SoType getDefaultType( const SbName &theName ) const;
00241 SbBool isNullByDefault( int thePartNumber ) const;
00245 SbBool isNullByDefault( const SbName &theName ) const;
00249 SbBool isLeaf( int thePartNumber ) const;
00253 SbBool isLeaf( const SbName &theName ) const;
00257 const SbName &getParentName( int thePartNumber ) const;
00261 const SbName &getParentName( const SbName &theName ) const;
00265 int getParentPartNumber( int thePartNumber ) const;
00269 int getParentPartNumber(const SbName &theName ) const;
00273 const SbName &getRightSiblingName( int thePartNumber ) const;
00277 const SbName &getRightSiblingName(const SbName &theName ) const;
00281 int getRightSiblingPartNumber( int thePartNumber ) const;
00285 int getRightSiblingPartNumber(const SbName &theName ) const;
00289 SbBool isList( int thePartNumber ) const;
00293 SbBool isList( const SbName &theName ) const;
00297 SoType getListContainerType( int thePartNumber ) const;
00301 SoType getListContainerType( const SbName &theName ) const;
00306 const SoTypeList &getListItemTypes( int thePartNumber ) const;
00311 const SoTypeList &getListItemTypes( const SbName &theName ) const;
00315 SbBool isPublic( int thePartNumber ) const;
00319 SbBool isPublic( const SbName &theName ) const;
00320
00321 private:
00322
00323
00324
00325
00326
00327 SoNodekitCatalog();
00328
00329
00330 ~SoNodekitCatalog();
00331
00332
00333
00334 SoNodekitCatalog *clone( SoType typeOfThis ) const;
00335
00336
00337 SbBool addEntry(const SbName &theName,
00338 SoType theType, SoType theDefaultType,
00339 SbBool theNullByDefault,
00340 const SbName &theParentName,
00341 const SbName &theRightSiblingName, SbBool theListPart,
00342 SoType theListContainerType,
00343 SoType theListItemType,
00344 SbBool thePublicPart);
00345
00346
00347 void addListItemType(int thePartNumber, SoType typeToAdd);
00348 void addListItemType(const SbName &theName, SoType typeToAdd);
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 void narrowTypes( const SbName &theName, SoType newType,
00363 SoType newDefaultType );
00364
00365 void setNullByDefault( const SbName &theName, SbBool newNullByDefault );
00366
00367 private:
00368
00369
00370
00371 SbBool recursiveSearch( int partNumber, const SbName &nameToFind,
00372 SoTypeList *typesChecked) const;
00373
00374 void printCheck() const;
00375
00376 private:
00377 static const SbName *emptyName;
00378 static const SoTypeList *emptyList;
00379 static SoType *badType;
00380
00381 int numEntries;
00382 SoNodekitCatalogEntry **entries;
00383 SbDict partNameDict;
00384
00385
00386 SbBool checkName( const SbName &theName );
00387 SbBool checkNewName( const SbName &theName );
00388 SbBool checkNewTypes( SoType theType,
00389 SoType theDefaultType );
00390 SbBool checkAndGetParent( const SbName &theName,
00391 const SbName &theParentName,
00392 SoNodekitCatalogEntry *& parentEntry );
00393 SbBool checkAndGetSiblings( const SbName &theParentName,
00394 const SbName &theRightSiblingName,
00395 SoNodekitCatalogEntry *& leftEntry,
00396 SoNodekitCatalogEntry *& rightEntry );
00397 SbBool checkCanTypesBeList( SoType theType,
00398 SoType theDefaultType,
00399 SoType theListContainerType );
00400
00401 };
00402
00403 #endif
00404
00405