00001 #ifndef X3DTK_X3DABSTRACTNODE_H 00002 #define X3DTK_X3DABSTRACTNODE_H 00003 00004 #include "X3DTypes.h" 00005 #include "X3DFileElement.h" 00006 #include "SFType.h" 00007 00008 namespace X3DTK { 00009 00010 class FileElement; 00011 00017 class X3DAbstractNode 00018 { 00019 public: 00021 X3DAbstractNode(); 00023 virtual SFAbstractNode clone() const; 00025 virtual ~X3DAbstractNode(); 00026 00028 void setName(const SFString &name); 00029 00031 inline const SFString &getName() const {return _name;}; 00033 inline SFString getTypeName() const {return _type->getName();}; 00035 inline SFType *getType() const {return _type;}; 00037 virtual MFAbstractNode getChildrenList() const; 00039 inline MFAbstractNode getParentList() const {return _parentList;}; 00040 00043 virtual bool addChild(const SFAbstractNode &N); 00046 virtual bool setChild(const SFAbstractNode &N); 00048 virtual bool removeChild(const SFAbstractNode &N); 00049 00050 protected: 00052 X3DAbstractNode(const X3DAbstractNode &N); 00053 00056 inline void defineTypeName(const SFString &name, const SFString &component = SFString(""), const SFString &sceneGraph = SFString("")) {SFType::defineTypeName(&_type, name, component, sceneGraph);}; 00058 static void addParentToChild(SFAbstractNode parent, SFAbstractNode child); 00060 static void removeParentFromChild(SFAbstractNode parent, SFAbstractNode child); 00061 00062 private: 00064 inline void addOneReference() {_type->addOneReferenceRecursive();}; 00065 00066 SFString _name; 00067 SFType *_type; 00068 MFAbstractNode _parentList; 00069 00071 void addParent(const SFAbstractNode &N); 00073 bool removeParent(const SFAbstractNode &N); 00074 }; 00075 00076 } 00077 00078 #endif