Salome HOME
Remove warnings
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeParameter.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 //  File   : SALOMEDSImpl_AttributeIOR.hxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
27 #define _SALOMEDSImpl_AttributeParameter_HeaderFile
28
29 #include "SALOMEDSImpl_Defines.hxx"
30 #include "DF_Attribute.hxx"
31 #include "DF_Label.hxx"
32 #include "SALOMEDSImpl_GenericAttribute.hxx"
33
34 #include <vector>
35 #include <string>
36 #include <map>
37
38 enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
39
40 /*!
41 Class: SALOMEDSImpl_AttributeParameter
42 Description : AttributeParameter is a universal container of basic types 
43 */
44
45 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeParameter : 
46   public SALOMEDSImpl_GenericAttribute 
47 {
48
49 private:
50
51   std::map<std::string, int>                          _ints;
52   std::map<std::string, double>                       _reals;
53   std::map<std::string, std::string>                  _strings;
54   std::map<std::string, bool>                         _bools;
55   std::map< std::string, std::vector<double> >        _realarrays;
56   std::map< std::string, std::vector<int> >           _intarrays;
57   std::map< std::string, std::vector<std::string> >   _strarrays;
58
59 public:
60
61   static const std::string& GetID() ;
62   
63   SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
64   static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
65       
66   void SetInt(const std::string& theID, const int& theValue);
67   int GetInt(const std::string& theID);
68           
69   void SetReal(const std::string& theID, const double& theValue);
70   double GetReal(const std::string& theID);
71               
72   void SetString(const std::string& theID, const std::string& theValue);
73   std::string GetString(const std::string& theID);
74                   
75   void SetBool(const std::string& theID, const bool& theValue);
76   bool GetBool(const std::string& theID);
77                       
78   void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
79   std::vector<double> GetRealArray(const std::string& theID);
80                           
81   void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
82   std::vector<int> GetIntArray(const std::string& theID);
83                               
84   void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
85   std::vector<std::string> GetStrArray(const std::string& theID);
86                                   
87   bool IsSet(const std::string& theID, const Parameter_Types theType);
88  
89   bool RemoveID(const std::string& theID, const Parameter_Types theType);
90                       
91   SALOMEDSImpl_AttributeParameter* GetFather();
92   bool HasFather();
93   bool IsRoot();
94                                             
95   std::vector<std::string> GetIDs(const Parameter_Types theType);
96                                               
97   void Clear();
98                                                 
99   virtual std::string Save();
100   virtual void Load(const std::string& theValue);
101                                                     
102   const std::string& ID() const;
103   void Restore(DF_Attribute* with) ;
104   DF_Attribute* NewEmpty() const;
105   void Paste(DF_Attribute* into);
106                                                             
107   ~SALOMEDSImpl_AttributeParameter() {}
108 };
109
110 #endif