Version: 7.8.0
DF_Container.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef DFCONTAINER_HXX
21 #define DFCONTAINER_HXX
22 
23 #include "DF_definitions.hxx"
24 #include "DF_Attribute.hxx"
25 #include <string>
26 #include <map>
27 
28 //Class DF_Container is used to store several types of data
29 class DF_Container : public DF_Attribute
30 {
31 public:
32 
33  //Static method that returns an ID of the give type of attributes
34  Standard_EXPORT static const std::string& GetID();
35 
36  //Creates if not exists a Container attribute and places if is not placed it the Label
37  Standard_EXPORT static DF_Container* Set(DF_Label& theLabel);
38 
39  //Constructor
41 
42  //Destructor
44 
45  //Sets an integer value of the attribute with given ID
46  Standard_EXPORT void SetInt(const std::string& theID, int theValue);
47 
48  //Returns an integer value of the attribute with given ID
49  Standard_EXPORT int GetInt(const std::string& theID);
50 
51  //Returns True if there is an integer with given ID
52  Standard_EXPORT bool HasIntID(const std::string& theID);
53 
54  //Sets a double value of the attribute with given ID
55  Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue);
56 
57  //Returns a double value of the attribute with given ID
58  Standard_EXPORT double GetDouble(const std::string& theID);
59 
60  //Returns True if there is a double with given ID
61  Standard_EXPORT bool HasDoubleID(const std::string& theID);
62 
63  //Sets a string value of the attribute with given ID
64  Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
65 
66  //Returns a string value of the attribute with given ID
67  Standard_EXPORT std::string GetString(const std::string& theID);
68 
69  //Returns True if there is a string with given ID
70  Standard_EXPORT bool HasStringID(const std::string& theID);
71 
72  //Sets a boolean value of the attribute with given ID
73  Standard_EXPORT void SetBool(const std::string& theID, bool theValue);
74 
75  //Returns a boolean value of the attribute with given ID
76  Standard_EXPORT bool GetBool(const std::string& theID);
77 
78  //Returns True if there is a boolean value with given ID
79  Standard_EXPORT bool HasBoolID(const std::string& theID);
80 
81  //Clears a content of the attribute
82  Standard_EXPORT void Clear();
83 
84  //ID is a std::string that uniquely identify the given type of Attributes within the Application.
85  Standard_EXPORT virtual const std::string& ID() const;
86 
87  //Restores a content of this Attribute from another Attribute
88  Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute);
89 
90  //Creates a new empty copy of this Attribute
91  Standard_EXPORT virtual DF_Attribute* NewEmpty() const;
92 
93  //Pastes a content of this Attribute into another Attribute
94  Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute);
95 
96 
97 protected:
98  std::map<std::string, int> _ints;
99  std::map<std::string, double> _doubles;
100  std::map<std::string, std::string> _strings;
101  std::map<std::string, bool> _bools;
102 };
103 
104 #endif