Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-18 08:40:44

0001 // Created on: 2004-11-23
0002 // Created by: Pavel TELKOV
0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 // The original implementation Copyright: (C) RINA S.p.A
0017 
0018 #ifndef TObj_TObject_HeaderFile
0019 #define TObj_TObject_HeaderFile
0020 
0021 #include <TObj_Object.hxx>
0022 
0023 #include <TDF_Attribute.hxx>
0024 
0025 class Standard_GUID;
0026 class TDF_Label;
0027 
0028 /**
0029  * Purpose: OCAF Attribute to storing objects (interfaces) of OCAF-based
0030  * modelers in the OCAF tree.
0031  * The persistency mechanism of the TObj_TObject allows to save
0032  * and restore objects of various subtypes without recompilation of the schema
0033  */
0034 
0035 class TObj_TObject : public TDF_Attribute
0036 {
0037 public:
0038   //! Standard methods of OCAF attribute
0039 
0040   //! Empty constructor
0041   Standard_EXPORT TObj_TObject();
0042 
0043   //! This method is used in implementation of ID()
0044   static Standard_EXPORT const Standard_GUID& GetID();
0045 
0046   //! Returns the ID of TObj_TObject attribute.
0047   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0048 
0049 public:
0050   //! Method for create TObj_TObject object
0051 
0052   //! Creates TObj_TObject attribute on given label
0053   static Standard_EXPORT Handle(TObj_TObject) Set(const TDF_Label&           theLabel,
0054                                                   const Handle(TObj_Object)& theElem);
0055 
0056 public:
0057   //! Methods for setting and obtaining TObj_Object
0058 
0059   //! Sets the TObj_Object object
0060   Standard_EXPORT void Set(const Handle(TObj_Object)& theElem);
0061 
0062   //! Returns the TObj_Object object
0063   Standard_EXPORT Handle(TObj_Object) Get() const;
0064 
0065 public:
0066   //! Redefined OCAF abstract methods
0067 
0068   //! Returns an new empty TObj_TObject attribute. It is used by the
0069   //! copy algorithm.
0070   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0071 
0072   //! Restores the backuped contents from <theWith> into this one. It is used
0073   //! when aborting a transaction.
0074   Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith) Standard_OVERRIDE;
0075 
0076   //! This method is used when copying an attribute from a source structure
0077   //! into a target structure.
0078   Standard_EXPORT void Paste(const Handle(TDF_Attribute)&       theInto,
0079                              const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
0080 
0081   //! Tell TObj_Object to die,
0082   //! i.e. (myElem->IsAlive() == false) after that
0083   Standard_EXPORT void BeforeForget() Standard_OVERRIDE;
0084 
0085   //! Tell TObj_Object to rise from the dead,
0086   //! i.e. (myElem->IsAlive() == true) after that
0087   Standard_EXPORT Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
0088                                              const Standard_Boolean forceIt) Standard_OVERRIDE;
0089 
0090 private:
0091   //! Fields
0092   Handle(TObj_Object) myElem; //!< The object interface stored by the attribute
0093 
0094 public:
0095   //! CASCADE RTTI
0096   DEFINE_STANDARD_RTTIEXT(TObj_TObject, TDF_Attribute)
0097 };
0098 
0099 //! Define handle class for TObj_TObject
0100 DEFINE_STANDARD_HANDLE(TObj_TObject, TDF_Attribute)
0101 
0102 #endif
0103 
0104 #ifdef _MSC_VER
0105 #pragma once
0106 #endif