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 FileElement; 00016 00018 00019 class X3DAbstractNode 00020 { 00021 public: 00023 X3DAbstractNode(); 00025 virtual ~X3DAbstractNode(); 00026 00028 //inline SFString getName() const {return DEFDict.getNameOfNode((X3DAbstractNode *)this);}; 00030 inline SFString getTypeName() const {return _type->getName();}; 00032 inline Type *getType() const {return _type;}; 00034 inline MFAbstractNode getParentList() const {return _parentList;}; 00035 00038 virtual bool addChild(const SFAbstractNode &N); 00041 virtual bool setChild(const SFAbstractNode &N); 00043 virtual bool removeChild(const SFAbstractNode &N); 00044 00046 void addParent(const SFAbstractNode &N); 00048 bool removeParent(const SFAbstractNode &N); 00049 00051 static NameDict DEFDict; 00052 00053 protected: 00055 X3DAbstractNode(const X3DAbstractNode &N); 00056 00059 inline void defineTypeName(const SFString &name, const SFString &component = SFString(""), const SFString &sceneGraph = SFString("")) {Type::defineTypeName(&_type, name, component, sceneGraph);}; 00060 00061 inline void addOneReference() {_type->addOneReferenceRecursive();}; 00062 00063 private: 00064 Type *_type; 00065 MFAbstractNode _parentList; 00066 }; 00067 00068 } 00069 00070 #endif