Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

0001 // Created on: 2004-11-23
0002 // Created by: Pavel DURANDIN
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_TNameContainer_HeaderFile
0019 #define TObj_TNameContainer_HeaderFile
0020 
0021 #include <TObj_Container.hxx>
0022 #include <TDF_Attribute.hxx>
0023 
0024 
0025 /** 
0026 * This class provides OCAF Attribute to storing the unique names of object in
0027 * model. 
0028 */
0029 
0030 class TObj_TNameContainer : public TDF_Attribute
0031 {
0032   public:
0033   //! Standard methods of OCAF attribute
0034 
0035   //! Empty constructor
0036   Standard_EXPORT TObj_TNameContainer();
0037   
0038   //! This method is used in implementation of ID()
0039   static Standard_EXPORT const Standard_GUID& GetID();
0040   
0041   //! Returns the ID of TObj_TNameContainer attribute.
0042   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0043 
0044  public:
0045   //! Method for create TObj_TNameContainer object
0046   
0047   //! Creates TObj_DataMapOfNameLabel attribute on given label if not exist
0048   static Standard_EXPORT Handle(TObj_TNameContainer) Set(const TDF_Label& theLabel);
0049   
0050  public:
0051   //! Methods for adding and removing names
0052   
0053   //! Records name with label attached
0054   Standard_EXPORT void RecordName(const Handle(TCollection_HExtendedString)& theName,
0055                                   const TDF_Label& theLabel);
0056   
0057   //! Remove name from the map
0058   Standard_EXPORT void RemoveName(const Handle(TCollection_HExtendedString)& theName);
0059   
0060   //! Return True is theName is registered in the Map
0061   Standard_EXPORT Standard_Boolean IsRegistered(const Handle(TCollection_HExtendedString)& theName) const;
0062   
0063   //! Remove all names registered in container
0064   Standard_EXPORT void Clear();
0065 
0066  public:
0067   //! Methods for setting and obtaining TObj_TNameContainer
0068   
0069   //! Sets the TObj_DataMapOfNameLabel object
0070   Standard_EXPORT void Set(const TObj_DataMapOfNameLabel& theElem);
0071   
0072   //! Returns the TObj_DataMapOfNameLabel object
0073   Standard_EXPORT const TObj_DataMapOfNameLabel& Get() const;
0074   
0075  public:
0076   //! Redefined OCAF abstract methods 
0077     
0078   //! Returns an new empty TObj_TNameContainer attribute. It is used by the
0079   //! copy algorithm.
0080   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0081   
0082   //! Restores the backuped contents from <theWith> into this one. It is used 
0083   //! when aborting a transaction.
0084   Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith) Standard_OVERRIDE;
0085   
0086   //! This method is used when copying an attribute from a source structure
0087   //! into a target structure.
0088   Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto,
0089                              const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
0090   
0091  private:
0092   //! Fields
0093   TObj_DataMapOfNameLabel myMap; //!< The map of the names
0094   
0095  public:
0096   //! CASCADE RTTI
0097   DEFINE_STANDARD_RTTIEXT(TObj_TNameContainer,TDF_Attribute)
0098 };
0099 
0100 //! Define handle class for TObj_TObject
0101 DEFINE_STANDARD_HANDLE(TObj_TNameContainer,TDF_Attribute)
0102 
0103 #endif
0104 
0105 #ifdef _MSC_VER
0106 #pragma once
0107 #endif