Main Page   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 
00002 //                            SFType.h                                        //
00004 
00005 #ifndef SFTYPE_H
00006 #define SFTYPE_H
00007 
00008 #include "X3DTypes.h"
00009 #include "SFSceneGraph.h"
00010 #include "SFComponent.h"
00011 
00012 namespace X3DTK {
00013 
00014 class X3DActor;
00015 
00016 namespace X3D {
00017   class Creator;
00018   class X3DComponentCreator;
00019 }
00020 
00024 
00025 class SFType
00026 {
00027   friend class X3D::Creator;
00028   friend class Walker;
00029   friend class Visitor;
00030   friend class X3D::X3DComponentCreator;
00031   friend class X3DComponentWalker;
00032   friend class X3DComponentVisitor;
00033   friend class X3DAbstractNode;
00034 
00035 public:
00037   static SFType *getTypeOfName(const SFString &sceneGraph, const SFString &component, const SFString &name);
00039   static SFType *getTypeOfId(int id);
00041   static void recomputeIds();
00042   
00044   inline SFString getName() const {return _name;};
00046   inline SFString getComponentName() const {return _component->getName();};
00048   inline SFString getSceneGraphName() const {return _component->getSceneGraph()->getName();};
00050   inline int getId() const {return _id;};
00052   inline SFType *getParent() const {return _parent;};
00054   inline MFType getChildList() const {return _childList;};
00056   inline SFComponent *getComponent() const {return _component;};
00058   inline SFSceneGraph *getSceneGraph() const {return _component->getSceneGraph();};
00060   static void printDerivationTree();
00061     
00062 private:
00064   SFType(const SFString &name, const SFString &component, const SFString &sceneGraph);
00065   ~SFType();
00066 
00068   void setParent(SFType *parent);
00070   void addOneReference();
00072   void addOneReferenceRecursive();
00074   static void removeOneReference(SFType *type);
00075   
00077   static void defineTypeName(SFType **type, const SFString &name, const SFString &component, const SFString &sceneGraph);
00079   static void addActor(X3DActor *actor);
00081   static void removeActor(X3DActor *actor);
00082 
00085   static void beginFunctionDefinition();
00087   static void endFunctionDefinition();
00089   static SFString encodeKey(const SFString &sceneGraph, const SFString &component, const SFString &SFType);
00091   inline SFString getEncodedName() const {return encodeKey(getSceneGraphName(), getComponentName(), getName());};
00092   
00094   SFString _name;
00095   int _id;
00096   int _refCount;
00097   SFType *_parent;
00098   MFType _childList;
00099   SFComponent *_component;
00100   
00102   static int count;
00103   static MFType _typeList;  
00104   static std::list<X3DActor *> _actorList;
00105   static bool _functionDefinition;
00106  
00107   void printDerivationTree(SFString tab) const;
00108 };
00109 
00110 }
00111 
00112 #endif

Generated on Mon Jan 19 10:32:05 2004 for X3DToolKit by doxygen1.2.18