00001
00002
00004
00005 #ifndef COMPONENT_H
00006 #define COMPONENT_H
00007
00008 #include "X3DTypes.h"
00009 #include "SceneGraph.h"
00010
00011 namespace X3DTK {
00012
00013 class SceneGraph;
00014
00017
00018 class Component
00019 {
00020 friend class Type;
00021 friend class X3DComponent;
00022 friend class Walker;
00023 friend class Visitor;
00024
00025 public:
00027 static Component *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 SceneGraph *getSceneGraph() const {return _sceneGraph;};
00037
00038 private:
00039 Component(const SFString &name, const SFString &sceneGraph);
00040 ~Component();
00041
00043 void addType(Type *type);
00045 void addOneReference();
00047 static void removeOneReference(Component *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 SceneGraph *_sceneGraph;
00057
00058 static MFComponent _componentList;
00059 };
00060
00061 }
00062
00063 #endif