b311480e |
1 | // Created on: 2004-11-23 |
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_TObject_HeaderFile |
19 | #define TObj_TObject_HeaderFile |
20 | |
21 | #include <TObj_Common.hxx> |
22 | #include <TObj_Object.hxx> |
23 | |
24 | #include <TDF_Attribute.hxx> |
25 | |
7fd59977 |
26 | class Standard_GUID; |
27 | class TDF_Label; |
7fd59977 |
28 | |
29 | /** |
30 | * Purpose: OCAF Attribute to storing objects (interfaces) of OCAF-based |
31 | * modelers in the OCAF tree. |
32 | * The persistency mechanism of the TObj_TObject allowes to save |
33 | * and restore objects of various subtypes without recompilation of the schema |
34 | */ |
35 | |
36 | class TObj_TObject : public TDF_Attribute |
37 | { |
38 | public: |
39 | //! Standard methods of OCAF attribute |
40 | |
41 | //! Empty constructor |
42 | Standard_EXPORT TObj_TObject(); |
43 | |
44 | //! This method is used in implementation of ID() |
45 | static Standard_EXPORT const Standard_GUID& GetID(); |
46 | |
47 | //! Returns the ID of TObj_TObject attribute. |
79104795 |
48 | Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; |
7fd59977 |
49 | |
50 | public: |
51 | //! Method for create TObj_TObject object |
52 | |
53 | //! Creates TObj_TObject attribute on given label |
54 | static Standard_EXPORT Handle(TObj_TObject) Set(const TDF_Label& theLabel, |
55 | const Handle(TObj_Object)& theElem); |
56 | |
57 | public: |
58 | //! Methods for setting and obtaining TObj_Object |
59 | |
60 | //! Sets the TObj_Object object |
61 | Standard_EXPORT void Set(const Handle(TObj_Object)& theElem); |
62 | |
63 | //! Returns the TObj_Object object |
64 | Standard_EXPORT Handle(TObj_Object) Get() const; |
65 | |
66 | public: |
67 | //! Redefined OCAF abstract methods |
68 | |
69 | //! Returns an new empty TObj_TObject attribute. It is used by the |
70 | //! copy algorithm. |
79104795 |
71 | Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; |
7fd59977 |
72 | |
73 | //! Restores the backuped contents from <theWith> into this one. It is used |
74 | //! when aborting a transaction. |
79104795 |
75 | Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith) Standard_OVERRIDE; |
7fd59977 |
76 | |
77 | //! This method is used when copying an attribute from a source structure |
78 | //! into a target structure. |
79 | Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto, |
79104795 |
80 | const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE; |
7fd59977 |
81 | |
82 | //! Tell TObj_Object to die, |
83 | //! i.e. (myElem->IsAlive() == false) after that |
79104795 |
84 | Standard_EXPORT void BeforeForget() Standard_OVERRIDE; |
7fd59977 |
85 | |
86 | //! Tell TObj_Object to rise from the dead, |
87 | //! i.e. (myElem->IsAlive() == true) after that |
88 | Standard_EXPORT Standard_Boolean AfterUndo |
89 | (const Handle(TDF_AttributeDelta)& anAttDelta, |
79104795 |
90 | const Standard_Boolean forceIt) Standard_OVERRIDE; |
7fd59977 |
91 | |
92 | private: |
93 | //! Fields |
94 | Handle(TObj_Object) myElem; //!< The object interface stored by the attribute |
95 | |
96 | public: |
97 | //! CASCADE RTTI |
ec357c5c |
98 | DEFINE_STANDARD_RTTI(TObj_TObject, TDF_Attribute) |
7fd59977 |
99 | }; |
100 | |
101 | //! Define handle class for TObj_TObject |
102 | DEFINE_STANDARD_HANDLE(TObj_TObject,TDF_Attribute) |
103 | |
104 | #endif |
105 | |
106 | #ifdef _MSC_VER |
107 | #pragma once |
108 | #endif |