00001 #ifndef SFCOMPONENT_H 00002 #define SFCOMPONENT_H 00003 00004 #include "X3DTypes.h" 00005 #include "SFSceneGraph.h" 00006 00007 namespace X3DTK { 00008 00009 class SFSceneGraph; 00010 00021 class SFComponent 00022 { 00023 friend class SFType; 00024 friend class X3DComponent; 00025 friend class Walker; 00026 friend class Visitor; 00027 00028 public: 00030 static SFComponent *getComponent(const SFString &sceneGraph, const SFString &name); 00031 00033 inline const SFString &getName() const {return _name;}; 00035 inline const SFString &getSceneGraphName() const {return _sceneGraph->getName();}; 00037 inline const MFType &getTypeList() const {return _typeList;}; 00039 inline SFSceneGraph *getSceneGraph() const {return _sceneGraph;}; 00040 00041 private: 00042 SFComponent(const SFString &name, const SFString &sceneGraph); 00043 ~SFComponent(); 00044 00046 void addType(SFType *type); 00048 void addOneReference(); 00050 static void removeOneReference(SFComponent *component); 00052 static SFString encodeKey(const SFString &sceneGraph, const SFString &name); 00054 inline SFString getEncodedName() const {return encodeKey(getSceneGraphName(), getName());}; 00055 00056 SFString _name; 00057 int _refCount; 00058 MFType _typeList; 00059 SFSceneGraph *_sceneGraph; 00060 00061 static MFComponent _componentList; 00062 }; 00063 00064 } 00065 00066 #endif