00001
00002
00004
00005 #ifndef SFCOMPONENT_H
00006 #define SFCOMPONENT_H
00007
00008 #include "X3DTypes.h"
00009 #include "SFSceneGraph.h"
00010
00011 namespace X3DTK {
00012
00013 class SFSceneGraph;
00014
00017
00018 class SFComponent
00019 {
00020 friend class SFType;
00021 friend class X3DComponent;
00022 friend class Walker;
00023 friend class Visitor;
00024
00025 public:
00027 static SFComponent *getComponent(const SFString &sceneGraph, const SFString &name);
00028
00030 inline SFString getName() const {return _name;};
00032 inline SFString getSceneGraphName() const {return _sceneGraph->getName();};
00034 inline MFType getTypeList() const {return _typeList;};
00036 inline SFSceneGraph *getSceneGraph() const {return _sceneGraph;};
00037
00038 private:
00039 SFComponent(const SFString &name, const SFString &sceneGraph);
00040 ~SFComponent();
00041
00043 void addType(SFType *type);
00045 void addOneReference();
00047 static void removeOneReference(SFComponent *component);
00049 static SFString encodeKey(const SFString &sceneGraph, const SFString &name);
00051 inline SFString getEncodedName() const {return encodeKey(getSceneGraphName(), getName());};
00052
00053 SFString _name;
00054 int _refCount;
00055 MFType _typeList;
00056 SFSceneGraph *_sceneGraph;
00057
00058 static MFComponent _componentList;
00059 };
00060
00061 }
00062
00063 #endif