1 // Created on: 2004-11-23
2 // Created by: Pavel DURANDIN
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // The original implementation Copyright: (C) RINA S.p.A
18 #ifndef TObj_TNameContainer_HeaderFile
19 #define TObj_TNameContainer_HeaderFile
21 #include <TObj_Common.hxx>
22 #include <TObj_Container.hxx>
23 #include <TDF_Attribute.hxx>
27 * This class provides OCAF Attribute to storing the unique names of object in
31 class TObj_TNameContainer : public TDF_Attribute
34 //! Standard methods of OCAF attribute
37 Standard_EXPORT TObj_TNameContainer();
39 //! This method is used in implementation of ID()
40 static Standard_EXPORT const Standard_GUID& GetID();
42 //! Returns the ID of TObj_TNameContainer attribute.
43 Standard_EXPORT const Standard_GUID& ID() const;
46 //! Method for create TObj_TNameContainer object
48 //! Creates TObj_DataMapOfNameLabel attribute on given label if not exist
49 static Standard_EXPORT Handle(TObj_TNameContainer) Set(const TDF_Label& theLabel);
52 //! Methods for adding and removing names
54 //! Records name with label attached
55 Standard_EXPORT void RecordName(const Handle(TCollection_HExtendedString)& theName,
56 const TDF_Label& theLabel);
58 //! Remove name from the map
59 Standard_EXPORT void RemoveName(const Handle(TCollection_HExtendedString)& theName);
61 //! Return True is theName is registered in the Map
62 Standard_EXPORT Standard_Boolean IsRegistered(const Handle(TCollection_HExtendedString)& theName) const;
64 //! Remove all names registered in container
65 Standard_EXPORT void Clear();
68 //! Methods for setting and obtaining TObj_TNameContainer
70 //! Sets the TObj_DataMapOfNameLabel object
71 Standard_EXPORT void Set(const TObj_DataMapOfNameLabel& theElem);
73 //! Returns the TObj_DataMapOfNameLabel object
74 Standard_EXPORT const TObj_DataMapOfNameLabel& Get() const;
77 //! Redefined OCAF abstract methods
79 //! Returns an new empty TObj_TNameContainer attribute. It is used by the
81 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
83 //! Restores the backuped contents from <theWith> into this one. It is used
84 //! when aborting a transaction.
85 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith);
87 //! This method is used when copying an attribute from a source structure
88 //! into a target structure.
89 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto,
90 const Handle(TDF_RelocationTable)& theRT) const;
94 TObj_DataMapOfNameLabel myMap; //!< The map of the names
98 DEFINE_STANDARD_RTTI(TObj_TNameContainer, TDF_Attribute)
101 //! Define handle class for TObj_TObject
102 DEFINE_STANDARD_HANDLE(TObj_TNameContainer,TDF_Attribute)