00001
00002
00003
00005
00006
00011
00016
00021
00023
00024 #ifndef TYPE_H
00025 #define TYPE_H
00026
00027 #include "X3DTypes.h"
00028
00029 namespace X3DTK {
00030
00031 class Component;
00032 class X3DNodeProxy;
00033
00037
00038 class Type
00039 {
00040 friend class NodeCreationProxy;
00041 friend class NodeWalkingProxy;
00042 friend class NodeVisitingProxy;
00043 friend class X3DComponentCreator;
00044 friend class X3DComponentWalker;
00045 friend class X3DComponentVisitor;
00046 friend class X3DAbstractNode;
00047
00048 public:
00050 static Type *getTypeOfName(const SFString &component, const SFString &name);
00052 static Type *getTypeOfId(int id);
00054 static void recomputeIds();
00055
00057 inline SFString getName() const {return _name;};
00059 inline int getId() const {return _id;};
00061 inline Type *getParent() const {return _parent;};
00063 inline MFType getChildList() const {return _childList;};
00065 inline Component *getComponent() const {return _component;};
00067 static void printDerivationTree();
00068
00069 private:
00071 Type(const SFString &name);
00072 ~Type();
00073
00075 void setParent(const Type *parent);
00077 void addOneReference();
00079 void addOneReferenceRecursive();
00081 static void removeOneReference(Type *type);
00082
00084 static void defineTypeName(Type **type, const SFString &name, const SFString &component);
00086 static void addNodeProxy(X3DNodeProxy *proxy);
00088 static void removeNodeProxy(X3DNodeProxy *proxy);
00089
00092 static void beginFunctionDefinition();
00094 static void endFunctionDefinition();
00095
00096
00098 SFString _name;
00099 int _id;
00100 int _refCount;
00101 Type *_parent;
00102 MFType _childList;
00103 Component *_component;
00104
00106 static int count;
00107 static MFType _typeList;
00108 static MFNodeProxy _proxyList;
00109 static bool _functionDefinition;
00110
00111 void printDerivationTree(SFString tab) const;
00112 };
00113
00114 }
00115
00116 #endif