1 // Created on: 2007-05-29
2 // Created by: Vlad Romashko
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TDataStd_NamedData_HeaderFile
17 #define _TDataStd_NamedData_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <Standard_Integer.hxx>
25 #include <TColStd_DataMapOfStringInteger.hxx>
26 #include <Standard_Real.hxx>
27 #include <TDataStd_DataMapOfStringReal.hxx>
28 #include <TDataStd_DataMapOfStringString.hxx>
29 #include <Standard_Byte.hxx>
30 #include <TDataStd_DataMapOfStringByte.hxx>
31 #include <TColStd_HArray1OfInteger.hxx>
32 #include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
33 #include <TColStd_HArray1OfReal.hxx>
34 #include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
35 #include <Standard_OStream.hxx>
36 class TDataStd_HDataMapOfStringInteger;
37 class TDataStd_HDataMapOfStringReal;
38 class TDataStd_HDataMapOfStringString;
39 class TDataStd_HDataMapOfStringByte;
40 class TDataStd_HDataMapOfStringHArray1OfInteger;
41 class TDataStd_HDataMapOfStringHArray1OfReal;
44 class TCollection_ExtendedString;
46 class TDF_RelocationTable;
49 class TDataStd_NamedData;
50 DEFINE_STANDARD_HANDLE(TDataStd_NamedData, TDF_Attribute)
52 //! Contains a named data.
53 class TDataStd_NamedData : public TDF_Attribute
61 //! Returns the ID of the named data attribute.
62 Standard_EXPORT static const Standard_GUID& GetID();
64 //! Finds or creates a named data attribute.
65 Standard_EXPORT static Handle(TDataStd_NamedData) Set (const TDF_Label& label);
67 Standard_EXPORT TDataStd_NamedData();
69 //! Returns true if at least one named integer value is
70 //! kept in the attribute.
71 Standard_Boolean HasIntegers() const;
73 //! Returns true if the attribute contains specified by Name
75 Standard_EXPORT Standard_Boolean HasInteger (const TCollection_ExtendedString& theName) const;
77 //! Returns the integer value specified by the Name.
78 //! It returns 0 if internal map doesn't contain the specified
79 //! integer (use HasInteger() to check before).
80 Standard_EXPORT Standard_Integer GetInteger (const TCollection_ExtendedString& theName);
82 //! Defines a named integer.
83 //! If the integer already exists, it changes its value to <theInteger>.
84 Standard_EXPORT void SetInteger (const TCollection_ExtendedString& theName, const Standard_Integer theInteger);
86 //! Returns the internal container of named integers.
87 Standard_EXPORT const TColStd_DataMapOfStringInteger& GetIntegersContainer();
89 //! Replace the container content by new content of the <theIntegers>.
90 Standard_EXPORT void ChangeIntegers (const TColStd_DataMapOfStringInteger& theIntegers);
92 //! Returns true if at least one named real value is
93 //! kept in the attribute.
94 Standard_Boolean HasReals() const;
96 //! Returns true if the attribute contains a real specified by Name.
97 Standard_EXPORT Standard_Boolean HasReal (const TCollection_ExtendedString& theName) const;
99 //! Returns the named real.
100 //! It returns 0.0 if there is no such a named real
102 Standard_EXPORT Standard_Real GetReal (const TCollection_ExtendedString& theName);
104 //! Defines a named real.
105 //! If the real already exists, it changes its value to <theReal>.
106 Standard_EXPORT void SetReal (const TCollection_ExtendedString& theName, const Standard_Real theReal);
108 //! Returns the internal container of named reals.
109 Standard_EXPORT const TDataStd_DataMapOfStringReal& GetRealsContainer();
111 //! Replace the container content by new content of the <theReals>.
112 Standard_EXPORT void ChangeReals (const TDataStd_DataMapOfStringReal& theReals);
114 //! Returns true if there are some named strings in the attribute.
115 Standard_Boolean HasStrings() const;
117 //! Returns true if the attribute contains this named string.
118 Standard_EXPORT Standard_Boolean HasString (const TCollection_ExtendedString& theName) const;
120 //! Returns the named string.
121 //! It returns an empty string if there is no such a named string
122 //! (use HasString()).
123 Standard_EXPORT const TCollection_ExtendedString& GetString (const TCollection_ExtendedString& theName);
125 //! Defines a named string.
126 //! If the string already exists, it changes its value to <theString>.
127 Standard_EXPORT void SetString (const TCollection_ExtendedString& theName, const TCollection_ExtendedString& theString);
129 //! Returns the internal container of named strings.
130 Standard_EXPORT const TDataStd_DataMapOfStringString& GetStringsContainer();
132 //! Replace the container content by new content of the <theStrings>.
133 Standard_EXPORT void ChangeStrings (const TDataStd_DataMapOfStringString& theStrings);
135 //! Returns true if there are some named bytes in the attribute.
136 Standard_Boolean HasBytes() const;
138 //! Returns true if the attribute contains this named byte.
139 Standard_EXPORT Standard_Boolean HasByte (const TCollection_ExtendedString& theName) const;
141 //! Returns the named byte.
142 //! It returns 0 if there is no such a named byte
144 Standard_EXPORT Standard_Byte GetByte (const TCollection_ExtendedString& theName);
146 //! Defines a named byte.
147 //! If the byte already exists, it changes its value to <theByte>.
148 Standard_EXPORT void SetByte (const TCollection_ExtendedString& theName, const Standard_Byte theByte);
150 //! Returns the internal container of named bytes.
151 Standard_EXPORT const TDataStd_DataMapOfStringByte& GetBytesContainer();
153 //! Replace the container content by new content of the <theBytes>.
154 Standard_EXPORT void ChangeBytes (const TDataStd_DataMapOfStringByte& theBytes);
156 //! Returns true if there are some named arrays of integer values in the attribute.
157 Standard_Boolean HasArraysOfIntegers() const;
159 //! Returns true if the attribute contains this named array of integer values.
160 Standard_EXPORT Standard_Boolean HasArrayOfIntegers (const TCollection_ExtendedString& theName) const;
162 //! Returns the named array of integer values.
163 //! It returns a NULL Handle if there is no such a named array of integers
164 //! (use HasArrayOfIntegers()).
165 Standard_EXPORT const Handle(TColStd_HArray1OfInteger)& GetArrayOfIntegers (const TCollection_ExtendedString& theName);
167 //! Defines a named array of integer values.
168 //! If the array already exists, it changes its value to <theArrayOfIntegers>.
169 Standard_EXPORT void SetArrayOfIntegers (const TCollection_ExtendedString& theName, const Handle(TColStd_HArray1OfInteger)& theArrayOfIntegers);
171 //! Returns the internal container of named arrays of integer values.
172 Standard_EXPORT const TDataStd_DataMapOfStringHArray1OfInteger& GetArraysOfIntegersContainer();
174 //! Replace the container content by new content of the <theArraysOfIntegers>.
175 Standard_EXPORT void ChangeArraysOfIntegers (const TDataStd_DataMapOfStringHArray1OfInteger& theArraysOfIntegers);
177 //! Returns true if there are some named arrays of real values in the attribute.
178 Standard_Boolean HasArraysOfReals() const;
180 //! Returns true if the attribute contains this named array of real values.
181 Standard_EXPORT Standard_Boolean HasArrayOfReals (const TCollection_ExtendedString& theName) const;
183 //! Returns the named array of real values.
184 //! It returns a NULL Handle if there is no such a named array of reals
185 //! (use HasArrayOfReals()).
186 Standard_EXPORT const Handle(TColStd_HArray1OfReal)& GetArrayOfReals (const TCollection_ExtendedString& theName);
188 //! Defines a named array of real values.
189 //! If the array already exists, it changes its value to <theArrayOfReals>.
190 Standard_EXPORT void SetArrayOfReals (const TCollection_ExtendedString& theName, const Handle(TColStd_HArray1OfReal)& theArrayOfReals);
192 //! Returns the internal container of named arrays of real values.
193 Standard_EXPORT const TDataStd_DataMapOfStringHArray1OfReal& GetArraysOfRealsContainer();
195 //! Replace the container content by new content of the <theArraysOfReals>.
196 Standard_EXPORT void ChangeArraysOfReals (const TDataStd_DataMapOfStringHArray1OfReal& theArraysOfReals);
198 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
200 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
202 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
204 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
206 Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
211 DEFINE_STANDARD_RTTIEXT(TDataStd_NamedData,TDF_Attribute)
221 Handle(TDataStd_HDataMapOfStringInteger) myIntegers;
222 Handle(TDataStd_HDataMapOfStringReal) myReals;
223 Handle(TDataStd_HDataMapOfStringString) myStrings;
224 Handle(TDataStd_HDataMapOfStringByte) myBytes;
225 Handle(TDataStd_HDataMapOfStringHArray1OfInteger) myArraysOfIntegers;
226 Handle(TDataStd_HDataMapOfStringHArray1OfReal) myArraysOfReals;
232 #include <TDataStd_NamedData.lxx>
238 #endif // _TDataStd_NamedData_HeaderFile