Salome HOME
merge from branch BR_V5_DEV
[modules/kernel.git] / src / DF / DF_Attribute.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef DFATTRIBUTE_HXX
23 #define DFATTRIBUTE_HXX
24
25 #include "DF_definitions.hxx"
26 #include <string>
27
28 class DF_Label;
29 class DF_LabelNode;
30
31 //Class DF_Attribute is used to store some data defined by the DF_Attribute type
32 class DF_Attribute {
33 protected:
34   DF_LabelNode* _node;
35
36 public:
37   //Constructor
38   Standard_EXPORT DF_Attribute();
39
40   Standard_EXPORT virtual ~DF_Attribute();
41
42   //Returns a Label on which this Attribute is located.
43   Standard_EXPORT DF_Label Label() const;
44
45   //Searches an Attribute with given ID located on the same Label as this Attribute.
46   Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const;
47
48
49   Standard_EXPORT virtual std::string Save() { return ""; } 
50   Standard_EXPORT virtual void Load(const std::string&) {}
51
52   //######## Virtual methods that must be redefined in descendants of the DF_Attribute 
53
54   //This method must be redefined in all descendents of the DF_Attribute
55   //ID is a std::string that uniquely identify the given type of Attributes within the Application.
56   Standard_EXPORT virtual const std::string& ID() const = 0;
57
58   //Restores a content of this Attribute from another Attribute
59   Standard_EXPORT virtual  void Restore(DF_Attribute* theAttribute) = 0;
60
61   //Creates a new empty copy oà this Attribute
62   Standard_EXPORT virtual DF_Attribute* NewEmpty() const = 0;
63
64   //Pastes a content of this Attribute into another Attribute 
65   Standard_EXPORT virtual  void Paste(DF_Attribute* theIntoAttribute) = 0;
66
67  
68   //######## Callbacks
69
70   Standard_EXPORT virtual void AfterAddition() {}
71   Standard_EXPORT virtual void BeforeForget() {}
72
73 protected:
74   void Backup() {}
75
76   
77 friend class DF_Label;
78   
79 };
80
81 #endif