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