00001 00002 // X3DAbstractNode.h // 00004 00005 #ifndef X3DABSTRACTNODE_H 00006 #define X3DABSTRACTNODE_H 00007 00008 #include "X3DTypes.h" 00009 #include "X3DFileElement.h" 00010 #include "SFType.h" 00011 00012 namespace X3DTK { 00013 00014 class FileElement; 00015 00017 00018 class X3DAbstractNode 00019 { 00020 public: 00022 X3DAbstractNode(); 00024 virtual SFAbstractNode clone() const; 00026 virtual ~X3DAbstractNode(); 00027 00029 void setName(const SFString &name); 00030 00032 inline const SFString &getName() const {return _name;}; 00034 inline SFString getTypeName() const {return _type->getName();}; 00036 inline SFType *getType() const {return _type;}; 00038 virtual MFAbstractNode getChildrenList() const; 00040 inline MFAbstractNode getParentList() const {return _parentList;}; 00041 00044 virtual bool addChild(const SFAbstractNode &N); 00047 virtual bool setChild(const SFAbstractNode &N); 00049 virtual bool removeChild(const SFAbstractNode &N); 00050 00051 protected: 00053 X3DAbstractNode(const X3DAbstractNode &N); 00054 00057 inline void defineTypeName(const SFString &name, const SFString &component = SFString(""), const SFString &sceneGraph = SFString("")) {SFType::defineTypeName(&_type, name, component, sceneGraph);}; 00059 inline void addOneReference() {_type->addOneReferenceRecursive();}; 00061 static void addParentToChild(SFAbstractNode parent, SFAbstractNode child); 00063 static void removeParentFromChild(SFAbstractNode parent, SFAbstractNode child); 00064 00065 private: 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