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 {
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
00187 class SoNodekitCatalog {
00188
00189 private:
00190
00194 static void initClass();
00195 static void exitClass();
00196
00197 public:
00198
00202 int getNumEntries() const { return numEntries; };
00203
00204
00205
00206 #ifdef DEBUG_NODEKITS
00207
00210 long getPartNumber( const SbName &theName ) const;
00211 #else
00212
00215 int getPartNumber( const SbName &theName ) const;
00216 #endif
00217
00220 const SbName &getName( int thePartNumber ) const;
00224 SoType getType( int thePartNumber ) const;
00228 SoType getType( const SbName &theName ) const;
00232 SoType getDefaultType( int thePartNumber ) const;
00236 SoType getDefaultType( const SbName &theName ) const;
00240 SbBool isNullByDefault( int thePartNumber ) const;
00244 SbBool isNullByDefault( const SbName &theName ) const;
00248 SbBool isLeaf( int thePartNumber ) const;
00252 SbBool isLeaf( const SbName &theName ) const;
00256 const SbName &getParentName( int thePartNumber ) const;
00260 const SbName &getParentName( const SbName &theName ) const;
00264 int getParentPartNumber( int thePartNumber ) const;
00268 int getParentPartNumber(const SbName &theName ) const;
00272 const SbName &getRightSiblingName( int thePartNumber ) const;
00276 const SbName &getRightSiblingName(const SbName &theName ) const;
00280 int getRightSiblingPartNumber( int thePartNumber ) const;
00284 int getRightSiblingPartNumber(const SbName &theName ) const;
00288 SbBool isList( int thePartNumber ) const;
00292 SbBool isList( const SbName &theName ) const;
00296 SoType getListContainerType( int thePartNumber ) const;
00300 SoType getListContainerType( const SbName &theName ) const;
00305 const SoTypeList &getListItemTypes( int thePartNumber ) const;
00310 const SoTypeList &getListItemTypes( const SbName &theName ) const;
00314 SbBool isPublic( int thePartNumber ) const;
00318 SbBool isPublic( const SbName &theName ) const;
00319
00320 private:
00321
00322
00323
00324
00325
00326 SoNodekitCatalog();
00327
00328
00329 ~SoNodekitCatalog();
00330
00331
00332
00333 SoNodekitCatalog *clone( SoType typeOfThis ) const;
00334
00335
00336 SbBool addEntry(const SbName &theName,
00337 SoType theType, SoType theDefaultType,
00338 SbBool theNullByDefault,
00339 const SbName &theParentName,
00340 const SbName &theRightSiblingName, SbBool theListPart,
00341 SoType theListContainerType,
00342 SoType theListItemType,
00343 SbBool thePublicPart);
00344
00345
00346 void addListItemType(int thePartNumber, SoType typeToAdd);
00347 void addListItemType(const SbName &theName, SoType typeToAdd);
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361 void narrowTypes( const SbName &theName, SoType newType,
00362 SoType newDefaultType );
00363
00364 void setNullByDefault( const SbName &theName, SbBool newNullByDefault );
00365
00366 private:
00367
00368
00369
00370 SbBool recursiveSearch( int partNumber, const SbName &nameToFind,
00371 SoTypeList *typesChecked) const;
00372
00373 void printCheck() const;
00374
00375 private:
00376 static const SbName *emptyName;
00377 static const SoTypeList *emptyList;
00378 static SoType *badType;
00379
00380 int numEntries;
00381 SoNodekitCatalogEntry **entries;
00382 SbDict partNameDict;
00383
00384
00385 SbBool checkName( const SbName &theName );
00386 SbBool checkNewName( const SbName &theName );
00387 SbBool checkNewTypes( SoType theType,
00388 SoType theDefaultType );
00389 SbBool checkAndGetParent( const SbName &theName,
00390 const SbName &theParentName,
00391 SoNodekitCatalogEntry *& parentEntry );
00392 SbBool checkAndGetSiblings( const SbName &theParentName,
00393 const SbName &theRightSiblingName,
00394 SoNodekitCatalogEntry *& leftEntry,
00395 SoNodekitCatalogEntry *& rightEntry );
00396 SbBool checkCanTypesBeList( SoType theType,
00397 SoType theDefaultType,
00398 SoType theListContainerType );
00399
00400 };
00401
00402 #endif
00403
00404