1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDSImpl_AttributeIOR.hxx
24 // Author : Sergey RUIN
27 #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
28 #define _SALOMEDSImpl_AttributeParameter_HeaderFile
30 #include "SALOMEDSImpl_Defines.hxx"
31 #include "DF_Attribute.hxx"
32 #include "DF_Label.hxx"
33 #include "SALOMEDSImpl_GenericAttribute.hxx"
39 enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
42 Class: SALOMEDSImpl_AttributeParameter
43 Description : AttributeParameter is a universal container of basic types
46 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeParameter :
47 public SALOMEDSImpl_GenericAttribute
52 std::map<std::string, int> _ints;
53 std::map<std::string, double> _reals;
54 std::map<std::string, std::string> _strings;
55 std::map<std::string, bool> _bools;
56 std::map< std::string, std::vector<double> > _realarrays;
57 std::map< std::string, std::vector<int> > _intarrays;
58 std::map< std::string, std::vector<std::string> > _strarrays;
62 static const std::string& GetID() ;
64 SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
65 static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
67 void SetInt(const std::string& theID, const int& theValue);
68 int GetInt(const std::string& theID);
70 void SetReal(const std::string& theID, const double& theValue);
71 double GetReal(const std::string& theID);
73 void SetString(const std::string& theID, const std::string& theValue);
74 std::string GetString(const std::string& theID);
76 void SetBool(const std::string& theID, const bool& theValue);
77 bool GetBool(const std::string& theID);
79 void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
80 std::vector<double> GetRealArray(const std::string& theID);
82 void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
83 std::vector<int> GetIntArray(const std::string& theID);
85 void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
86 std::vector<std::string> GetStrArray(const std::string& theID);
88 bool IsSet(const std::string& theID, const Parameter_Types theType);
90 bool RemoveID(const std::string& theID, const Parameter_Types theType);
92 SALOMEDSImpl_AttributeParameter* GetFather();
96 std::vector<std::string> GetIDs(const Parameter_Types theType);
100 virtual std::string Save();
101 virtual void Load(const std::string& theValue);
103 const std::string& ID() const;
104 void Restore(DF_Attribute* with) ;
105 DF_Attribute* NewEmpty() const;
106 void Paste(DF_Attribute* into);
108 ~SALOMEDSImpl_AttributeParameter() {}