1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_AttributeTreeNode.hxx
21 // Author : Sergey RUIN
24 #ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile
25 #define _SALOMEDSImpl_AttributeTreeNode_HeaderFile
27 #include <Standard_DefineHandle.hxx>
28 #include <TDF_Attribute.hxx>
29 #include <Standard_GUID.hxx>
30 #include <TDF_Label.hxx>
31 #include <TDF_AttributeDelta.hxx>
32 #include <TCollection_AsciiString.hxx>
33 #include "SALOMEDSImpl_GenericAttribute.hxx"
35 class Handle_TDF_DataSet;
36 class Handle(TDF_Attribute);
37 class Handle(TDF_RelocationTable);
38 class SALOMEDSImpl_ChildNodeIterator;
40 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
42 class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute
46 Standard_EXPORT const static Standard_GUID& GetDefaultTreeID();
47 Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTreeNode Set(const TDF_Label& L, const Standard_GUID& ID);
49 Standard_EXPORT SALOMEDSImpl_AttributeTreeNode();
50 Standard_EXPORT void SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
51 Standard_EXPORT void SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
52 Standard_EXPORT void SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
53 Standard_EXPORT void SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
54 Standard_EXPORT void SetTreeID(const Standard_GUID& value);
56 Standard_EXPORT Standard_Boolean Append(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
57 Standard_EXPORT Standard_Boolean Prepend(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
58 Standard_EXPORT Standard_Boolean Remove();
59 Standard_EXPORT Standard_Boolean InsertBefore(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
60 Standard_EXPORT Standard_Boolean InsertAfter(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
62 Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFather() { return myFather; }
63 Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetPrevious() { return myPrevious; }
64 Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetNext() { return myNext; }
65 Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFirst() { return myFirst; }
67 Standard_EXPORT Standard_Boolean HasFather() { return (!myFather.IsNull()); }
68 Standard_EXPORT Standard_Boolean HasPrevious() { return (!myPrevious.IsNull()); }
69 Standard_EXPORT Standard_Boolean HasNext() {return (!myNext.IsNull()); }
70 Standard_EXPORT Standard_Boolean HasFirst() { return (!myFirst.IsNull()); }
71 Standard_EXPORT const Standard_GUID& GetTreeID() { return ID(); }
72 Standard_EXPORT Standard_Integer Depth() const;
73 Standard_EXPORT Standard_Boolean IsRoot() const ;
74 Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) Root() const;
75 Standard_EXPORT Standard_Boolean IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const;
76 Standard_EXPORT Standard_Boolean IsDescendant(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
77 Standard_EXPORT Standard_Boolean IsFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
78 Standard_EXPORT Standard_Boolean IsChild(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
80 Standard_EXPORT virtual TCollection_AsciiString Save();
81 Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
82 Standard_EXPORT virtual TCollection_AsciiString Type();
84 Standard_EXPORT virtual void AfterAddition() ;
85 Standard_EXPORT virtual void BeforeForget() ;
86 Standard_EXPORT virtual void AfterResume() ;
87 Standard_EXPORT virtual Standard_Boolean BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
88 const Standard_Boolean forceIt = Standard_False) ;
89 Standard_EXPORT virtual Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
90 const Standard_Boolean forceIt = Standard_False) ;
91 Standard_EXPORT const Standard_GUID& ID() const;
92 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
93 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
94 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
95 Standard_EXPORT void References(const Handle(TDF_DataSet)& aDataSet) const;
96 Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {}
99 DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTreeNode )
103 Standard_GUID myTreeID;
104 Handle(SALOMEDSImpl_AttributeTreeNode) myFather;
105 Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious;
106 Handle(SALOMEDSImpl_AttributeTreeNode) myNext;
107 Handle(SALOMEDSImpl_AttributeTreeNode) myFirst;
109 friend class SALOMEDSImpl_ChildNodeIterator;