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/
20 // File : SALOMEDSImpl_AttributeIOR.hxx
21 // Author : Sergey RUIN
24 #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
25 #define _SALOMEDSImpl_AttributeParameter_HeaderFile
27 #include <Standard_DefineHandle.hxx>
28 #include <TDF_Attribute.hxx>
29 #include <TCollection_AsciiString.hxx>
30 #include <TCollection_ExtendedString.hxx>
31 #include <TDF_Label.hxx>
32 #include "SALOMEDSImpl_GenericAttribute.hxx"
39 class Handle(TDF_Attribute);
40 class Handle(TDF_RelocationTable);
43 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
45 enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
48 Class: SALOMEDSImpl_AttributeParameter
49 Description : AttributeParameter is a universal container of basic types
52 class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute
57 std::map<std::string, int> _ints;
58 std::map<std::string, double> _reals;
59 std::map<std::string, std::string> _strings;
60 std::map<std::string, bool> _bools;
61 std::map< std::string, vector<double> > _realarrays;
62 std::map< std::string, vector<int> > _intarrays;
63 std::map< std::string, vector<std::string> > _strarrays;
66 Standard_EXPORT static const Standard_GUID& GetID() ;
68 Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
69 Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L);
72 Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
73 Standard_EXPORT int GetInt(const std::string& theID);
75 Standard_EXPORT void SetReal(const std::string& theID, const double& theValue);
76 Standard_EXPORT double GetReal(const std::string& theID);
78 Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
79 Standard_EXPORT std::string GetString(const std::string& theID);
81 Standard_EXPORT void SetBool(const std::string& theID, const bool& theValue);
82 Standard_EXPORT bool GetBool(const std::string& theID);
84 Standard_EXPORT void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
85 Standard_EXPORT std::vector<double> GetRealArray(const std::string& theID);
87 Standard_EXPORT void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
88 Standard_EXPORT std::vector<int> GetIntArray(const std::string& theID);
90 Standard_EXPORT void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
91 Standard_EXPORT std::vector<std::string> GetStrArray(const std::string& theID);
93 Standard_EXPORT bool IsSet(const std::string& theID, const Parameter_Types theType);
95 Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
97 Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather();
98 Standard_EXPORT bool HasFather();
99 Standard_EXPORT bool IsRoot();
101 Standard_EXPORT std::vector<std::string> GetIDs(const Parameter_Types theType);
103 Standard_EXPORT void Clear();
105 Standard_EXPORT virtual TCollection_AsciiString Save();
106 Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
108 Standard_EXPORT const Standard_GUID& ID() const;
109 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
110 Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
111 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
113 Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {}
116 DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter )