Salome HOME
Fix pb. with loading of last module (in list).
[modules/kernel.git] / src / DF / DF_Container.hxx
1 #ifndef DFCONTAINER_HXX
2 #define DFCONTAINER_HXX
3
4 #include "DF_definitions.hxx"
5 #include "DF_Attribute.hxx"
6 #include <string>
7 #include <map>
8
9 //Class DF_Container is used to store several types of data 
10 class DF_Container : public DF_Attribute 
11 {
12 public:
13
14   //Static method that returns an ID of the give type of attributes
15   Standard_EXPORT static const std::string& GetID();
16
17   //Creates if not exists a Container attribute and places if is not placed it the Label
18   Standard_EXPORT static DF_Container* Set(DF_Label& theLabel);
19
20   //Constructor
21   Standard_EXPORT DF_Container();
22
23   //Destructor
24   Standard_EXPORT ~DF_Container();
25
26   //Sets an integer value of the attribute with given ID
27   Standard_EXPORT void SetInt(const std::string& theID, int theValue);
28
29   //Returns an integer value of the attribute with given ID
30   Standard_EXPORT int GetInt(const std::string& theID);
31
32   //Returns True if there is an integer with given ID
33   Standard_EXPORT bool HasIntID(const std::string& theID);
34
35   //Sets a double value of the attribute with given ID
36   Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue);
37
38   //Returns a double value of the attribute with given ID
39   Standard_EXPORT double GetDouble(const std::string& theID);
40
41   //Returns True if there is a double with given ID
42   Standard_EXPORT bool HasDoubleID(const std::string& theID);
43  
44   //Sets a string value of the attribute with given ID
45   Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
46
47   //Returns a string  value of the attribute with given ID
48   Standard_EXPORT std::string GetString(const std::string& theID);
49
50   //Returns True if there is a string with given ID
51   Standard_EXPORT bool HasStringID(const std::string& theID);
52
53   //Sets a boolean value of the attribute with given ID
54   Standard_EXPORT void SetBool(const std::string& theID, bool theValue);
55
56   //Returns a boolean value of the attribute with given ID
57   Standard_EXPORT bool GetBool(const std::string& theID);
58
59   //Returns True if there is a boolean value with given ID
60   Standard_EXPORT bool HasBoolID(const std::string& theID);
61
62   //Clears a content of the attribute
63   Standard_EXPORT void Clear();
64
65   //ID is a std::string that uniquely identify the given type of Attributes within the Application.
66   Standard_EXPORT virtual const std::string& ID() const;
67
68   //Restores a content of this Attribute from another Attribute
69   Standard_EXPORT virtual  void Restore(DF_Attribute* theAttribute);
70
71   //Creates a new empty copy of this Attribute
72   Standard_EXPORT virtual DF_Attribute* NewEmpty() const;
73
74   //Pastes a content of this Attribute into another Attribute 
75   Standard_EXPORT virtual  void Paste(DF_Attribute* theIntoAttribute);
76
77   
78 protected:
79   std::map<std::string, int>         _ints;
80   std::map<std::string, double>      _doubles;
81   std::map<std::string, std::string> _strings;
82   std::map<std::string, bool>        _bools;
83 };
84
85 #endif