b311480e |
1 | // Created on: 2004-11-22 |
2 | // Created by: Pavel TELKOV |
973c2be1 |
3 | // Copyright (c) 2004-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | // The original implementation Copyright: (C) RINA S.p.A |
17 | |
18 | #ifndef TObj_Object_HeaderFile |
19 | #define TObj_Object_HeaderFile |
20 | |
21 | #include <TObj_Common.hxx> |
22 | #include <TObj_DeletingMode.hxx> |
23 | #include <TObj_SequenceOfObject.hxx> |
7fd59977 |
24 | |
25 | #include <TDF_Label.hxx> |
26 | #include <gp_XYZ.hxx> |
27 | |
c04c30b3 |
28 | class TObj_Model; |
7fd59977 |
29 | class TObj_Persistence; |
c04c30b3 |
30 | class TObj_ObjectIterator; |
31 | class TObj_TNameContainer; |
32 | class TCollection_HExtendedString; |
92efcf78 |
33 | #include <TColStd_HArray1OfInteger.hxx> |
34 | #include <TColStd_HArray1OfReal.hxx> |
35 | #include <TColStd_HArray1OfExtendedString.hxx> |
c04c30b3 |
36 | |
37 | class TObj_Object; |
25e59720 |
38 | DEFINE_STANDARD_HANDLE(TObj_Object,Standard_Transient) |
7fd59977 |
39 | |
40 | //! Basis class for transient objects in OCAF-based models |
41 | |
25e59720 |
42 | class TObj_Object : public Standard_Transient |
7fd59977 |
43 | { |
44 | public: |
45 | enum TypeFlags //!< Flags that define type-specific behaviour of objects |
46 | { |
47 | Visible = 0x0001 //!< Is visible in DataViewer |
48 | }; |
49 | |
50 | //! enumeration describing various object state bit flags (see Set/GetFlags()) |
51 | enum ObjectState |
52 | { |
53 | ObjectState_Hidden = 0x0001, //!< object is hidden in tree browser |
54 | ObjectState_Saved = 0x0002, //!< object has (or should have) |
55 | //!< corresponding saved file on disk |
56 | ObjectState_Imported = 0x0004, //!< object's data are just imported from somewhere |
57 | ObjectState_ImportedByFile = 0x0008, //!< a model imported by file may need a |
58 | //!< sophisticated update of external references |
59 | ObjectState_Ordered = 0x0010 //!< flag that partition contains ordered objects |
60 | }; |
61 | |
62 | protected: |
63 | |
64 | //! enumeration for the ranks of label under Data section. |
65 | enum DataTag |
66 | { |
67 | DataTag_First = 0, |
68 | DataTag_Flags, //!< stores flags of object |
69 | DataTag_Order, //!< stores order of object |
70 | DataTag_Last = DataTag_First + 100 //!< Reserved for possible future use |
71 | }; |
72 | |
73 | //! enumeration for the ranks of label under Child section. |
74 | enum ChildTag |
75 | { |
76 | ChildTag_First = 0, |
77 | ChildTag_Last = ChildTag_First //!< No children |
78 | }; |
79 | |
80 | //! enumeration for the ranks of label under Reference section. |
81 | enum RefTag |
82 | { |
83 | RefTag_First = 0, |
84 | RefTag_Last = RefTag_First //!< No children |
85 | }; |
86 | |
87 | protected: |
88 | /** |
89 | * Constructors |
90 | */ |
91 | |
92 | //! Constructor of a new object interface: requires label, |
93 | //! which should be one of the labels in model's data structure. |
94 | //! This creates a new object and attaches it to a given label. |
95 | //! The initialisation of the object's data and their integrity is |
96 | //! to be ensured by implementations and by persistence mechanism. |
97 | //! If the flag theSetName is true (default) the object is assign the default name |
98 | //! that is generated using the father partition object if any. |
99 | Standard_EXPORT TObj_Object (const TDF_Label& theLabel, |
0f57ab75 |
100 | const Standard_Boolean theSetName = Standard_True); |
7fd59977 |
101 | |
102 | //! The special constructor intended for implementation of persistence |
103 | //! mechanism. See class TObj_Persistence for more details. |
104 | //! The first argument is used only to avoid confusion with |
105 | //! other constructors. |
0f57ab75 |
106 | TObj_Object (const TObj_Persistence *, const TDF_Label& theLabel) : myLabel(theLabel) {} |
7fd59977 |
107 | |
108 | //! This method is called from persistence to initialize the object fields, |
109 | //! so successors that have transient fields must initialize them in initFields(), |
110 | //! and call the same method of parent. |
111 | void initFields() {} |
112 | |
113 | public: |
114 | /** |
115 | * Virtual methods |
116 | */ |
117 | |
118 | //! Returns the model to which the object belongs |
119 | virtual Standard_EXPORT Handle(TObj_Model) GetModel () const; |
120 | |
121 | //! Returns iterator for the child objects. |
122 | //! This method provides tree-like view of the objects hierarchy. |
123 | //! The references to other objects are not considered as children. |
124 | //! theType narrows a variety of iterated objects |
125 | //! The default implementation search for children on 1 sublavel |
126 | //! of the children sub label |
127 | virtual Standard_EXPORT Handle(TObj_ObjectIterator) GetChildren |
128 | (const Handle(Standard_Type)& theType = NULL) const; |
129 | |
130 | //! Returns the label under which children are stored |
131 | Standard_EXPORT TDF_Label GetChildLabel() const; |
132 | |
133 | //! Returns the label for child with rank |
134 | Standard_EXPORT TDF_Label getChildLabel(const Standard_Integer theRank) const; |
135 | |
136 | public: |
137 | /** |
138 | * Access to the OCAF-specific data |
139 | */ |
140 | |
141 | //! Returns the OCAF label on which object`s data are stored |
142 | Standard_EXPORT TDF_Label GetLabel() const; |
143 | |
144 | //! Returns the label which is the root for data OCAF sub-tree |
145 | Standard_EXPORT TDF_Label GetDataLabel() const; |
146 | |
147 | //! Returns the label which is the root for reference OCAF sub-tree |
148 | Standard_EXPORT TDF_Label GetReferenceLabel() const; |
149 | |
150 | public: |
151 | /** |
152 | * Methods hanling name of the object |
153 | */ |
154 | |
155 | //! Returns the map of names of the objects |
156 | //! Default implementation returns global Dictionary of the model |
157 | virtual Standard_EXPORT Handle(TObj_TNameContainer) GetDictionary() const; |
158 | |
159 | //! Returns the name of the object (empty string if object has no name) |
160 | virtual Standard_EXPORT Handle(TCollection_HExtendedString) GetName() const; |
161 | |
162 | //! Returns the Standard_True is object has name and returns name to theName |
163 | Standard_EXPORT Standard_Boolean GetName |
164 | (TCollection_ExtendedString& theName) const; |
165 | |
166 | //! Returns the Standard_True is object has name and returns name to theName |
167 | Standard_EXPORT Standard_Boolean GetName |
168 | (TCollection_AsciiString& theName) const; |
169 | |
170 | //! Sets name of the object. Returns False if theName is not unique. |
171 | virtual Standard_EXPORT Standard_Boolean SetName |
172 | (const Handle(TCollection_HExtendedString)& theName) const; |
173 | |
174 | //! Sets name of the object. Returns False if theName is not unique. |
175 | Standard_EXPORT Standard_Boolean SetName |
176 | (const Handle(TCollection_HAsciiString)& theName) const; |
177 | |
178 | //! Sets name of the object. Returns False if theName is not unique. |
179 | Standard_EXPORT Standard_Boolean SetName (const Standard_CString name) const; |
180 | |
181 | //! Returns name for copy |
182 | //! default implementation returns the same name |
be5c3602 |
183 | virtual Handle(TCollection_HExtendedString) GetNameForClone |
7fd59977 |
184 | ( const Handle(TObj_Object)& ) const |
185 | { return GetName(); } |
186 | |
187 | public: |
188 | /** |
189 | * Analysis of dependencies on other objects |
190 | */ |
191 | |
192 | //! Returns True if object has reference to indicated object |
193 | virtual Standard_EXPORT Standard_Boolean HasReference |
194 | (const Handle(TObj_Object)& theObject) const; |
195 | |
196 | //! Returns an Iterator containing objects that compose the this one |
197 | //! theType narrows a variety of iterated objects |
198 | virtual Standard_EXPORT Handle(TObj_ObjectIterator) GetReferences |
199 | (const Handle(Standard_Type)& theType = NULL) const; |
200 | |
201 | //! Remove all references to other objects, by removing all reference attributes |
202 | virtual Standard_EXPORT void RemoveAllReferences(); |
203 | |
204 | //! Returns iterator for the objects which depend on this one. |
205 | //! These reffering objects may belong to other models. |
206 | //! theType narrows a variety of iterated objects |
207 | virtual Standard_EXPORT Handle(TObj_ObjectIterator) GetBackReferences |
208 | (const Handle(Standard_Type)& theType = NULL) const; |
209 | |
210 | //! Registers another object as being dependent on this one. |
211 | //! Stores back references under sublabel 2 (purely transient data, |
212 | //! not subject to persistency). |
213 | virtual Standard_EXPORT void AddBackReference |
214 | (const Handle(TObj_Object)& theObject); |
215 | |
216 | //! Removes information on dependent object (back reference). |
217 | //! If theSingleOnly is true only the first back reference is removed in the |
218 | //! case of duplicate items. |
219 | virtual Standard_EXPORT void RemoveBackReference |
220 | (const Handle(TObj_Object)& theObject, |
221 | const Standard_Boolean theSingleOnly = Standard_True); |
222 | |
223 | //! Removes all back reference by removing references from other to me. |
224 | virtual Standard_EXPORT Standard_Boolean RemoveBackReferences |
225 | (const TObj_DeletingMode theMode = TObj_FreeOnly); |
226 | |
227 | //! The default implementation just clear the back references container |
228 | virtual Standard_EXPORT void ClearBackReferences(); |
229 | |
230 | //! Returns TRUE if obejct has 1 or more back references |
231 | Standard_EXPORT Standard_Boolean HasBackReferences() const; |
232 | |
233 | //! Replace reference from old object to new object. |
234 | //! If it is not possible, may raise exception. |
235 | //! If new object is null then simple remove reference to old object. |
236 | virtual Standard_EXPORT void ReplaceReference |
237 | (const Handle(TObj_Object)& theOldObject, |
238 | const Handle(TObj_Object)& theNewObject); |
239 | |
240 | //! Return True if this refers to the model theRoot belongs |
241 | //! to and a referred label is not a descendant of theRoot. |
242 | //! In this case theBadReference returns the currently referred label. |
243 | virtual Standard_EXPORT Standard_Boolean GetBadReference |
244 | (const TDF_Label& theRoot, |
245 | TDF_Label& theBadReference) const; |
246 | |
247 | //! Make that each reference pointing to a descendant label of |
248 | //! theFromRoot to point to an equivalent label under theToRoot. |
249 | //! Return False if a resulting reference does not point to |
250 | //! an TObj_Object |
251 | //! Example: |
252 | //! a referred object label = 0:3:24:7:2:7 |
253 | //! theFromRoot = 0:3:24 |
254 | //! theToRoot = 0:2 |
255 | //! a new referred label = 0:2:7:2:7 |
256 | virtual Standard_EXPORT Standard_Boolean RelocateReferences |
257 | (const TDF_Label& theFromRoot, |
258 | const TDF_Label& theToRoot, |
259 | const Standard_Boolean theUpdateBackRefs = Standard_True); |
260 | |
261 | //! Returns True if the referred object theObject can be deleted |
262 | //! without deletion of this object. |
263 | //! Default implementation does nothing and returns False. |
264 | virtual Standard_EXPORT Standard_Boolean CanRemoveReference |
265 | (const Handle(TObj_Object)& theObject) const; |
266 | |
267 | //! Removes reference to the object by replace reference to NULL object |
268 | virtual Standard_EXPORT void RemoveReference (const Handle(TObj_Object)& theObject); |
269 | |
270 | //! Invokes from TObj_TReference::BeforeForget(). |
271 | //! theLabel - label on that reference become removed |
272 | //! Default implementation is empty |
be5c3602 |
273 | virtual void BeforeForgetReference( const TDF_Label& /*theLabel*/ ) |
7fd59977 |
274 | {} |
275 | |
276 | public: |
277 | /** |
278 | * Methods for deleting the object |
279 | */ |
280 | |
281 | //! Checks if object can be detached with specified mode |
282 | virtual Standard_EXPORT Standard_Boolean CanDetach(const TObj_DeletingMode theMode = TObj_FreeOnly); |
283 | |
284 | //! Deletes the object from the model. |
285 | //! The dependent objects are either deleted or modified when possible |
286 | //! (see description of TObj_DeletingMode enumeration for more details) |
287 | //! Returns True if deletion was successful. |
288 | //! Checks if object can be deleted. |
289 | //! Should be redefined for each specific kind of object |
290 | virtual Standard_EXPORT Standard_Boolean Detach |
291 | (const TObj_DeletingMode theMode = TObj_FreeOnly); |
292 | |
293 | //! Deletes the object from the label. Checks if object can be deleted. |
294 | //! Finds object on the label and detaches it by calling previos method. |
295 | //! Returns true if there is no object on the label after detaching |
296 | static Standard_EXPORT Standard_Boolean Detach |
297 | (const TDF_Label& theLabel, |
298 | const TObj_DeletingMode theMode = TObj_FreeOnly); |
299 | |
300 | |
301 | public: |
302 | /** |
303 | * methods for object retrieval |
304 | */ |
305 | |
306 | //! Returns the Object attached to a given label. |
307 | //! Returns False if no object of type TObj_Object is stored on the |
308 | //! specified label. |
309 | //! If isSuper is true tries to find on the super labels. |
310 | static Standard_EXPORT Standard_Boolean GetObj |
311 | (const TDF_Label& theLabel, |
312 | Handle(TObj_Object)& theResult, |
313 | const Standard_Boolean isSuper = Standard_False); |
314 | |
315 | //! Returns the father object, which may be NULL |
316 | //! theType gives type of father object to search |
317 | Standard_EXPORT Handle(TObj_Object) GetFatherObject |
318 | (const Handle(Standard_Type)& theType = NULL) const; |
319 | |
320 | public: |
321 | /** |
322 | * Methods for checking and Updating object |
323 | */ |
324 | |
325 | //! Checks that object alive in model |
326 | //! Default implementation checks that object has TObject attribute at own label. |
327 | virtual Standard_EXPORT Standard_Boolean IsAlive() const; |
328 | |
329 | public: |
330 | /** |
331 | * Cloning related methods |
332 | */ |
333 | |
334 | //! Copy me to other label theTargetLabel |
335 | //! New object will not have all the reference that has me. |
336 | //! Coping object with data and childs, but change name by adding string "_copy" |
337 | //! As result return handle of new object (null handle is something wrong) |
338 | //! NOTE: BackReferences not coping. |
339 | //! After clonning all objects it is neccessary to call copy references |
340 | //! with the same relocation table |
341 | virtual Standard_EXPORT Handle(TObj_Object) Clone |
342 | (const TDF_Label& theTargetLabel, |
343 | Handle(TDF_RelocationTable) theRelocTable = 0); |
344 | |
345 | //! Coping the references. |
346 | //! return Standard_False is Target object is different type |
347 | virtual Standard_EXPORT void CopyReferences |
348 | (const Handle(TObj_Object)& theTargetObject, |
349 | const Handle(TDF_RelocationTable)& theRelocTable); |
350 | |
351 | //! Coping the children from source label to the target. |
352 | virtual Standard_EXPORT void CopyChildren |
353 | (TDF_Label& theTargetLabel, |
354 | const Handle(TDF_RelocationTable)& theRelocTable); |
355 | |
356 | |
357 | public: |
358 | /** |
359 | * Public methods to access order of object |
360 | */ |
361 | |
362 | //! returns order of object (or tag of their label if order is not initialised) |
363 | virtual Standard_EXPORT Standard_Integer GetOrder() const; |
364 | |
365 | //! sets order of object |
366 | virtual Standard_EXPORT Standard_Boolean SetOrder( const Standard_Integer& theIndx ); |
367 | |
368 | protected: |
369 | /** |
370 | * Protected Methods copy data of object to other object |
371 | */ |
372 | |
373 | //! Coping the data of me to Target object. |
374 | //! return Standard_False is Target object is different type |
375 | virtual Standard_EXPORT Standard_Boolean copyData |
376 | (const Handle(TObj_Object)& theTargetObject); |
377 | |
378 | //! Coping the references from source label to the target. |
379 | Standard_EXPORT void copyReferences |
380 | (const TDF_Label& theSourceLabel, |
381 | TDF_Label& theTargetLabel, |
382 | const Handle(TDF_RelocationTable)& theRelocTable); |
383 | |
384 | public: |
385 | /** |
386 | * Access to object flags |
387 | */ |
388 | |
389 | //! Returns flags (bitmask) that define properties of objects of that type |
390 | //! By default returns flag Visible |
391 | virtual Standard_EXPORT Standard_Integer GetTypeFlags() const; |
392 | |
393 | //! Returns mask of seted flags |
394 | Standard_EXPORT Standard_Integer GetFlags() const; |
395 | |
396 | //! Sets flags with defined mask. |
397 | Standard_EXPORT void SetFlags(const Standard_Integer theMask); |
398 | |
399 | //! tests flags by the mask. |
400 | Standard_EXPORT Standard_Boolean TestFlags(const Standard_Integer theMask) const; |
401 | |
402 | //! clears flags by the mask. |
403 | Standard_EXPORT void ClearFlags(const Standard_Integer theMask = ~0); |
404 | |
405 | public: |
406 | /** |
407 | * Method for updating object afrer restoring |
408 | */ |
409 | |
410 | //! Preforms updating the links and dependances of the object which are not |
411 | //! stored in persistence. Should be redefined if necessary. |
412 | virtual Standard_EXPORT void AfterRetrieval(); |
413 | |
414 | //! Preforms storing the objects transient fields in OCAF document |
415 | //! which were outside transaction mechanism. |
416 | //! Default implementation doesnot nothing |
417 | virtual Standard_EXPORT void BeforeStoring(); |
418 | |
419 | protected: |
420 | /** |
421 | * Internal tools for work with OCAF data |
422 | */ |
423 | |
424 | //! Returns the theRank2-th sub label of the theRank1-th sublabel of the |
425 | //! Data label of the object. |
426 | //! If theRank2 is 0 (default), sub label theRank1 of Data label is returned. |
427 | //! If requested label does not exist, it is created. |
428 | Standard_EXPORT TDF_Label getDataLabel |
429 | (const Standard_Integer theRank1, |
430 | const Standard_Integer theRank2 = 0) const; |
431 | |
432 | //! Returns the theRank2-th sub label of the theRank1-th sublabel of the |
433 | //! Reference label of the object. |
434 | //! If theRank2 is 0 (default), sub label theRank1 of Reference label is returned. |
435 | //! If requested label does not exist, it is created. |
436 | Standard_EXPORT TDF_Label getReferenceLabel |
437 | (const Standard_Integer theRank1, |
438 | const Standard_Integer theRank2 = 0) const; |
439 | |
440 | //! Returns True if there is an attribute having theGUID on the |
441 | //! theRank2-th sublabel of theRank1-th sublabel of the Data |
442 | //! label of the object. |
443 | //! If theRank2 is 0 (default), label theRank1 is supposed, not |
444 | //! its sublabel |
445 | Standard_EXPORT Standard_Boolean isDataAttribute |
446 | (const Standard_GUID& theGUID, |
447 | const Standard_Integer theRank1, |
448 | const Standard_Integer theRank2 = 0) const; |
449 | |
450 | //! Returns the real value from theRank2-th sublabel of theRank1-th |
451 | //! sublabel of the Data label of the object. |
452 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
453 | //! Returns 0.0 if no real value is stored on that label. |
454 | Standard_EXPORT Standard_Real getReal |
455 | (const Standard_Integer theRank1, |
456 | const Standard_Integer theRank2 = 0) const; |
457 | |
458 | //! Sets the real value for theRank2-th sublabel of theRank1-th |
459 | //! sublabel of the Data label of the object. |
460 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
461 | //! Returns True if new value is actually different from previous one |
462 | //! (with specified tolerance) |
463 | Standard_EXPORT Standard_Boolean setReal |
464 | (const Standard_Real theValue, |
465 | const Standard_Integer theRank1, |
466 | const Standard_Integer theRank2 = 0, |
467 | const Standard_Real theTolerance = 0.) const; |
468 | |
469 | //! Returns the integer value from theRank2-th sublabel of theRank1-th |
470 | //! sublabel of the Data label of the object. |
471 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
472 | //! Returns 0 if no integer value is stored on that label. |
473 | Standard_EXPORT Standard_Integer getInteger |
474 | (const Standard_Integer theRank1, |
475 | const Standard_Integer theRank2 = 0) const; |
476 | |
477 | //! Sets the integer value for theRank2-th sublabel of theRank1-th |
478 | //! sublabel of the Data label of the object. |
479 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
480 | //! Returns True if new value is actually different from previous one |
481 | Standard_EXPORT Standard_Boolean setInteger |
482 | (const Standard_Integer theValue, |
483 | const Standard_Integer theRank1, |
484 | const Standard_Integer theRank2 = 0) const; |
485 | |
486 | //! Returns an existing or create a new real array on theRank2-th |
487 | //! sublabel of theRank1-th sublabel of the Data label of the object. |
488 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
489 | //! A newly created array has 1 and theLength bounds and is initialized |
490 | //! with theInitialValue |
491 | //! |
492 | //! NOTE: do not create new array and returns NULL handle if no array on label |
493 | //! and theLength less than |
494 | //! |
495 | //! WARNING: call setArray() after array contents modification |
496 | //! in order to assure Undo work |
497 | Standard_EXPORT Handle(TColStd_HArray1OfReal) getRealArray |
498 | (const Standard_Integer theLength, |
499 | const Standard_Integer theRank1, |
500 | const Standard_Integer theRank2 = 0, |
501 | const Standard_Real theInitialValue = 0.0) const; |
502 | |
503 | //! Returns an existing or create a new integer array on theRank2-th |
504 | //! sublabel of theRank1-th sublabel of the Data label of the object. |
505 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
506 | //! A newly created array has 1 and theLength bounds and is initialized |
507 | //! with theInitialValue |
508 | //! |
509 | //! NOTE: do not create new array and returns NULL handle if no array on label |
510 | //! and theLength less than |
511 | //! |
512 | //! WARNING: call setArray() after array contents modification |
513 | //! in order to assure Undo work |
514 | Standard_EXPORT Handle(TColStd_HArray1OfInteger) getIntegerArray |
515 | (const Standard_Integer theLength, |
516 | const Standard_Integer theRank1, |
517 | const Standard_Integer theRank2 = 0, |
518 | const Standard_Integer theInitialValue = 0) const; |
519 | |
520 | //! Returns an existing or create a new string array on theRank2-th |
521 | //! sublabel of theRank1-th sublabel of the Data label of the object. |
522 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
523 | //! A newly created array has 1 and theLength bounds |
524 | //! NOTE: new created array is NOT initialized. |
525 | //! |
526 | //! NOTE: do not create new array and returns NULL handle if no array on label |
527 | //! and theLength less than |
528 | //! |
529 | //! WARNING: call setArray() after array contents modification |
530 | //! in order to assure Undo work |
531 | Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) getExtStringArray |
532 | (const Standard_Integer theLength, |
533 | const Standard_Integer theRank1, |
534 | const Standard_Integer theRank2 = 0) const; |
535 | |
536 | //! Store theArray on theRank2-th sublabel of theRank1-th sublabel |
537 | //! of the Data label of the object. |
538 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
539 | //! If theArray is null then array attribute if any is removed. |
540 | Standard_EXPORT void setArray |
541 | (const Handle(TColStd_HArray1OfReal)& theArray, |
542 | const Standard_Integer theRank1, |
543 | const Standard_Integer theRank2 = 0); |
544 | |
545 | //! Store theArray on theRank2-th sublabel of theRank1-th sublabel |
546 | //! of the Data label of the object. |
547 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
548 | //! If theArray is null then array attribute if any is removed. |
549 | Standard_EXPORT void setArray |
550 | (const Handle(TColStd_HArray1OfInteger)& theArray, |
551 | const Standard_Integer theRank1, |
552 | const Standard_Integer theRank2 = 0); |
553 | |
554 | //! Store theArray on theRank2-th sublabel of theRank1-th sublabel |
555 | //! of the Data label of the object. |
556 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
557 | //! If theArray is null then array attribute if any is removed. |
558 | Standard_EXPORT void setArray |
559 | (const Handle(TColStd_HArray1OfExtendedString)& theArray, |
560 | const Standard_Integer theRank1, |
561 | const Standard_Integer theRank2 = 0); |
562 | |
563 | //! Sets the string value for theRank2-th sublabel of theRank1-th |
564 | //! sublabel of the Data label of the object. |
565 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
566 | Standard_EXPORT void setExtString |
567 | (const Handle(TCollection_HExtendedString)& theValue, |
568 | const Standard_Integer theRank1, |
569 | const Standard_Integer theRank2 = 0) const; |
570 | |
571 | //! Returns the string value from theRank2-th sublabel of theRank1-th |
572 | //! sublabel of the Data label of the object. |
573 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
574 | Standard_EXPORT Handle(TCollection_HExtendedString) getExtString |
575 | (const Standard_Integer theRank1, |
576 | const Standard_Integer theRank2 = 0) const; |
577 | |
578 | //! Sets the ascii string value for theRank2-th sublabel of theRank1-th |
579 | //! sublabel of the Data label of the object. |
580 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
581 | Standard_EXPORT void setAsciiString |
582 | (const Handle(TCollection_HAsciiString)& theValue, |
583 | const Standard_Integer theRank1, |
584 | const Standard_Integer theRank2 = 0) const; |
585 | |
586 | //! Returns the string value from theRank2-th sublabel of theRank1-th |
587 | //! sublabel of the Data label of the object. |
588 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
589 | Standard_EXPORT Handle(TCollection_HAsciiString) getAsciiString |
590 | (const Standard_Integer theRank1, |
591 | const Standard_Integer theRank2 = 0) const; |
592 | |
593 | //! Returns the reference attribute from theRank2-th sublabel of theRank1-th |
594 | //! sublabel of the References label of the object. |
595 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
596 | Standard_EXPORT Handle(TObj_Object) getReference |
597 | (const Standard_Integer theRank1, |
598 | const Standard_Integer theRank2 = 0) const; |
599 | |
600 | //! Sets the reference to theObject on theRank2-th sublabel of theRank1-th |
601 | //! sublabel of the References label of the object. |
602 | //! If theRank2 is 0 (default), label theRank1 is supposed (not its sublabel). |
603 | //! Returns True if new value is actually different from previous one |
604 | //! If Object is NULL, reference is deleted |
605 | Standard_EXPORT Standard_Boolean setReference |
606 | (const Handle(TObj_Object) &theObject, |
607 | const Standard_Integer theRank1, |
608 | const Standard_Integer theRank2 = 0); |
609 | |
610 | //! Adds the reference to theObject on next free sublabel of theRank1-th |
611 | //! sublabel of the References label of the object and returns the Label. |
612 | Standard_EXPORT TDF_Label addReference |
613 | (const Standard_Integer theRank1, |
614 | const Handle(TObj_Object) &theObject); |
615 | |
616 | private: |
617 | /** |
618 | * Fields |
619 | */ |
620 | TDF_Label myLabel; //!< Label on which object`s data are stored |
621 | |
622 | Handle(TObj_HSequenceOfObject) myHSeqBackRef; //!< hsequence of back references. |
623 | |
624 | friend class TObj_TObject; |
625 | |
626 | public: |
627 | //! CASCADE RTTI |
25e59720 |
628 | DEFINE_STANDARD_RTTIEXT(TObj_Object,Standard_Transient) |
7fd59977 |
629 | }; |
630 | |
631 | //! Define handle in separate file |
632 | |
633 | #endif |
634 | |
635 | #ifdef _MSC_VER |
636 | #pragma once |
637 | #endif |