Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

SFType.h

Go to the documentation of this file.
00001 #ifndef X3DTK_SFTYPE_H
00002 #define X3DTK_SFTYPE_H
00003 
00004 #include "X3DTypes.h"
00005 #include "SFSceneGraph.h"
00006 #include "SFComponent.h"
00007 
00008 namespace X3DTK {
00009 
00010 class X3DActor;
00011 
00012 namespace X3D {
00013   class Creator;
00014   class X3DComponentCreator;
00015 }
00016 
00027 class SFType
00028 {
00029   friend class X3D::Creator;
00030   friend class Walker;
00031   friend class Visitor;
00032   friend class X3D::X3DComponentCreator;
00033   friend class X3DComponentWalker;
00034   friend class X3DComponentVisitor;
00035   friend class X3DAbstractNode;
00036 
00037 public:
00039   static SFType *getTypeOfName(const SFString &sceneGraph, const SFString &component, const SFString &name);
00041   static SFType *getTypeOfId(int id);
00043   static void recomputeIds();
00044   
00046   inline SFString getName() const {return _name;};
00048   inline SFString getComponentName() const {return _component->getName();};
00050   inline SFString getSceneGraphName() const {return _component->getSceneGraph()->getName();};
00052   inline int getId() const {return _id;};
00054   inline SFType *getParent() const {return _parent;};
00056   inline MFType getChildren() const {return _childList;};
00058   inline SFComponent *getComponent() const {return _component;};
00060   inline SFSceneGraph *getSceneGraph() const {return _component->getSceneGraph();};
00062   static void printInheritanceTree();
00063     
00064 private:
00066   SFType(const SFString &name, const SFString &component, const SFString &sceneGraph);
00067   ~SFType();
00068 
00070   void setParent(SFType *parent);
00072   void addOneReference();
00074   void addOneReferenceRecursive();
00076   static void removeOneReference(SFType *type);
00077   
00079   static void defineTypeName(SFType **type, const SFString &name, const SFString &component, const SFString &sceneGraph);
00081   static void addActor(X3DActor *actor);
00083   static void removeActor(X3DActor *actor);
00084 
00087   static void beginFunctionDefinition();
00089   static void endFunctionDefinition();
00091   static SFString encodeKey(const SFString &sceneGraph, const SFString &component, const SFString &SFType);
00093   inline SFString getEncodedName() const {return encodeKey(getSceneGraphName(), getComponentName(), getName());};
00094   
00096   SFString _name;
00097   int _id;
00098   int _refCount;
00099   SFType *_parent;
00100   MFType _childList;
00101   SFComponent *_component;
00102   
00104   static int count;
00105   static MFType _typeList;  
00106   static std::list<X3DActor *> _actorList;
00107   static bool _functionDefinition;
00108  
00109   void printInheritanceTree(SFString tab) const;
00110 };
00111 
00112 }
00113 
00114 #endif

Generated on Wed Apr 7 12:15:21 2004 for X3DToolKit by doxygen 1.3.3