00001
00002
00004
00005 #ifndef TYPE_H
00006 #define TYPE_H
00007
00008 #include "X3DTypes.h"
00009
00010 namespace X3DTK {
00011
00012 class Component;
00013 class X3DNodeProxy;
00014
00018
00019 class Type
00020 {
00021 friend class NodeCreationProxy;
00022 friend class NodeWalkingProxy;
00023 friend class NodeVisitingProxy;
00024 friend class X3DComponentCreator;
00025 friend class X3DComponentWalker;
00026 friend class X3DComponentVisitor;
00027 friend class X3DAbstractNode;
00028
00029 public:
00031 static Type *getTypeOfName(const SFString &component, const SFString &name);
00033 static Type *getTypeOfId(int id);
00035 static void recomputeIds();
00036
00038 inline SFString getName() const {return _name;};
00040 inline int getId() const {return _id;};
00042 inline Type *getParent() const {return _parent;};
00044 inline MFType getChildList() const {return _childList;};
00046 inline Component *getComponent() const {return _component;};
00048 static void printDerivationTree();
00049
00050 private:
00052 Type(const SFString &name);
00053 ~Type();
00054
00056 void setParent(const Type *parent);
00058 void addOneReference();
00060 void addOneReferenceRecursive();
00062 static void removeOneReference(Type *type);
00063
00065 static void defineTypeName(Type **type, const SFString &name, const SFString &component);
00067 static void addNodeProxy(X3DNodeProxy *proxy);
00069 static void removeNodeProxy(X3DNodeProxy *proxy);
00070
00073 static void beginFunctionDefinition();
00075 static void endFunctionDefinition();
00076
00077
00079 SFString _name;
00080 int _id;
00081 int _refCount;
00082 Type *_parent;
00083 MFType _childList;
00084 Component *_component;
00085
00087 static int count;
00088 static MFType _typeList;
00089 static MFNodeProxy _proxyList;
00090 static bool _functionDefinition;
00091
00092 void printDerivationTree(SFString tab) const;
00093 };
00094
00095 }
00096
00097 #endif