Salome HOME
merge from branch BR_V5_DEV
[modules/kernel.git] / src / DF / DF_Container.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 DFCONTAINER_HXX
23 #define DFCONTAINER_HXX
24
25 #include "DF_definitions.hxx"
26 #include "DF_Attribute.hxx"
27 #include <string>
28 #include <map>
29
30 //Class DF_Container is used to store several types of data 
31 class DF_Container : public DF_Attribute 
32 {
33 public:
34
35   //Static method that returns an ID of the give type of attributes
36   Standard_EXPORT static const std::string& GetID();
37
38   //Creates if not exists a Container attribute and places if is not placed it the Label
39   Standard_EXPORT static DF_Container* Set(DF_Label& theLabel);
40
41   //Constructor
42   Standard_EXPORT DF_Container();
43
44   //Destructor
45   Standard_EXPORT ~DF_Container();
46
47   //Sets an integer value of the attribute with given ID
48   Standard_EXPORT void SetInt(const std::string& theID, int theValue);
49
50   //Returns an integer value of the attribute with given ID
51   Standard_EXPORT int GetInt(const std::string& theID);
52
53   //Returns True if there is an integer with given ID
54   Standard_EXPORT bool HasIntID(const std::string& theID);
55
56   //Sets a double value of the attribute with given ID
57   Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue);
58
59   //Returns a double value of the attribute with given ID
60   Standard_EXPORT double GetDouble(const std::string& theID);
61
62   //Returns True if there is a double with given ID
63   Standard_EXPORT bool HasDoubleID(const std::string& theID);
64  
65   //Sets a string value of the attribute with given ID
66   Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
67
68   //Returns a string  value of the attribute with given ID
69   Standard_EXPORT std::string GetString(const std::string& theID);
70
71   //Returns True if there is a string with given ID
72   Standard_EXPORT bool HasStringID(const std::string& theID);
73
74   //Sets a boolean value of the attribute with given ID
75   Standard_EXPORT void SetBool(const std::string& theID, bool theValue);
76
77   //Returns a boolean value of the attribute with given ID
78   Standard_EXPORT bool GetBool(const std::string& theID);
79
80   //Returns True if there is a boolean value with given ID
81   Standard_EXPORT bool HasBoolID(const std::string& theID);
82
83   //Clears a content of the attribute
84   Standard_EXPORT void Clear();
85
86   //ID is a std::string that uniquely identify the given type of Attributes within the Application.
87   Standard_EXPORT virtual const std::string& ID() const;
88
89   //Restores a content of this Attribute from another Attribute
90   Standard_EXPORT virtual  void Restore(DF_Attribute* theAttribute);
91
92   //Creates a new empty copy of this Attribute
93   Standard_EXPORT virtual DF_Attribute* NewEmpty() const;
94
95   //Pastes a content of this Attribute into another Attribute 
96   Standard_EXPORT virtual  void Paste(DF_Attribute* theIntoAttribute);
97
98   
99 protected:
100   std::map<std::string, int>         _ints;
101   std::map<std::string, double>      _doubles;
102   std::map<std::string, std::string> _strings;
103   std::map<std::string, bool>        _bools;
104 };
105
106 #endif