1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_AttributeIOR.hxx
21 // Author : Sergey RUIN
24 #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
25 #define _SALOMEDSImpl_AttributeParameter_HeaderFile
27 #include "DF_Attribute.hxx"
28 #include "DF_Label.hxx"
29 #include "SALOMEDSImpl_GenericAttribute.hxx"
35 enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
38 Class: SALOMEDSImpl_AttributeParameter
39 Description : AttributeParameter is a universal container of basic types
42 class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute
47 std::map<std::string, int> _ints;
48 std::map<std::string, double> _reals;
49 std::map<std::string, std::string> _strings;
50 std::map<std::string, bool> _bools;
51 std::map< std::string, std::vector<double> > _realarrays;
52 std::map< std::string, std::vector<int> > _intarrays;
53 std::map< std::string, std::vector<std::string> > _strarrays;
56 Standard_EXPORT static const std::string& GetID() ;
58 Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
59 Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
62 Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
63 Standard_EXPORT int GetInt(const std::string& theID);
65 Standard_EXPORT void SetReal(const std::string& theID, const double& theValue);
66 Standard_EXPORT double GetReal(const std::string& theID);
68 Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
69 Standard_EXPORT std::string GetString(const std::string& theID);
71 Standard_EXPORT void SetBool(const std::string& theID, const bool& theValue);
72 Standard_EXPORT bool GetBool(const std::string& theID);
74 Standard_EXPORT void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
75 Standard_EXPORT std::vector<double> GetRealArray(const std::string& theID);
77 Standard_EXPORT void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
78 Standard_EXPORT std::vector<int> GetIntArray(const std::string& theID);
80 Standard_EXPORT void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
81 Standard_EXPORT std::vector<std::string> GetStrArray(const std::string& theID);
83 Standard_EXPORT bool IsSet(const std::string& theID, const Parameter_Types theType);
85 Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
87 Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather();
88 Standard_EXPORT bool HasFather();
89 Standard_EXPORT bool IsRoot();
91 Standard_EXPORT std::vector<std::string> GetIDs(const Parameter_Types theType);
93 Standard_EXPORT void Clear();
95 Standard_EXPORT virtual std::string Save();
96 Standard_EXPORT virtual void Load(const std::string& theValue);
98 Standard_EXPORT const std::string& ID() const;
99 Standard_EXPORT void Restore(DF_Attribute* with) ;
100 Standard_EXPORT DF_Attribute* NewEmpty() const;
101 Standard_EXPORT void Paste(DF_Attribute* into);
103 Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {}