00001 00002 // X3DAbstractNode.h // 00004 00005 #ifndef X3DABSTRACTNODE_H 00006 #define X3DABSTRACTNODE_H 00007 00008 #include "X3DTypes.h" 00009 #include "X3DFileElement.h" 00010 #include "Type.h" 00011 #include "NameDict.h" 00012 00013 namespace X3DTK { 00014 00015 class Scene; 00016 class FileElement; 00017 00019 00020 class X3DAbstractNode 00021 { 00022 public: 00024 X3DAbstractNode(); 00026 virtual SFNode clone() const; 00028 virtual ~X3DAbstractNode(); 00029 00031 //inline SFString getName() const {return DEFDict.getNameOfNode((X3DAbstractNode *)this);}; 00033 inline SFString getTypeName() const {return _type->getName();}; 00035 inline Type *getType() const {return _type;}; 00037 inline MFScene getSceneList() const {return _sceneList;}; 00039 inline MFNode getParentList() const {return _parentList;}; 00040 00042 virtual void loadAttributes(const X3DFileElement *element); 00044 virtual SFString writeAttributes() const; 00045 00048 virtual bool addChild(const SFNode &N); 00051 virtual bool setChild(const SFNode &N); 00053 virtual bool removeChild(const SFNode &N); 00054 00055 static NameDict DEFDict; 00056 00057 protected: 00059 X3DAbstractNode(const X3DAbstractNode &N); 00060 00062 static void removeScenes(SFNode child, const MFScene &sceneList); 00064 virtual void removeScenesToChildren(const MFScene &sceneList); 00066 static void addScenes(SFNode child, const MFScene &sceneList); 00068 virtual void addScenesToChildren(const MFScene &sceneList); 00069 00071 static void removeLink(SFNode father, SFNode child); 00073 static void addLink(SFNode father, SFNode child); 00074 00077 inline void defineTagName(const SFString &name, const SFString &component = SFString("")) {Type::defineTagName(&_type, name, component);}; 00078 00079 MFScene _sceneList; 00080 00081 private: 00082 // Adds a parent. 00083 void addParent(const SFNode &N); 00084 // Removes a parent. 00085 bool removeParent(const SFNode &N); 00086 00087 Type *_type; 00088 MFNode _parentList; 00089 }; 00090 00091 } 00092 00093 #endif