0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / TObj / TObj_TNameContainer.hxx
CommitLineData
b311480e 1// Created on: 2004-11-23
2// Created by: Pavel DURANDIN
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_TNameContainer_HeaderFile
19#define TObj_TNameContainer_HeaderFile
20
21#include <TObj_Common.hxx>
22#include <TObj_Container.hxx>
23#include <TDF_Attribute.hxx>
24
c04c30b3 25class TObj_TNameContainer;
7fd59977 26
27/**
28* This class provides OCAF Attribute to storing the unique names of object in
29* model.
30*/
31
32class TObj_TNameContainer : public TDF_Attribute
33{
34 public:
35 //! Standard methods of OCAF attribute
36
37 //! Empty constructor
38 Standard_EXPORT TObj_TNameContainer();
39
40 //! This method is used in implementation of ID()
41 static Standard_EXPORT const Standard_GUID& GetID();
42
43 //! Returns the ID of TObj_TNameContainer attribute.
79104795 44 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
7fd59977 45
46 public:
47 //! Method for create TObj_TNameContainer object
48
49 //! Creates TObj_DataMapOfNameLabel attribute on given label if not exist
50 static Standard_EXPORT Handle(TObj_TNameContainer) Set(const TDF_Label& theLabel);
51
52 public:
53 //! Methods for adding and removing names
54
55 //! Records name with label attached
56 Standard_EXPORT void RecordName(const Handle(TCollection_HExtendedString)& theName,
57 const TDF_Label& theLabel);
58
59 //! Remove name from the map
60 Standard_EXPORT void RemoveName(const Handle(TCollection_HExtendedString)& theName);
61
62 //! Return True is theName is registered in the Map
63 Standard_EXPORT Standard_Boolean IsRegistered(const Handle(TCollection_HExtendedString)& theName) const;
64
65 //! Remove all names registered in container
66 Standard_EXPORT void Clear();
67
68 public:
69 //! Methods for setting and obtaining TObj_TNameContainer
70
71 //! Sets the TObj_DataMapOfNameLabel object
72 Standard_EXPORT void Set(const TObj_DataMapOfNameLabel& theElem);
73
74 //! Returns the TObj_DataMapOfNameLabel object
75 Standard_EXPORT const TObj_DataMapOfNameLabel& Get() const;
76
77 public:
78 //! Redefined OCAF abstract methods
79
80 //! Returns an new empty TObj_TNameContainer attribute. It is used by the
81 //! copy algorithm.
79104795 82 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
7fd59977 83
84 //! Restores the backuped contents from <theWith> into this one. It is used
85 //! when aborting a transaction.
79104795 86 Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theWith) Standard_OVERRIDE;
7fd59977 87
88 //! This method is used when copying an attribute from a source structure
89 //! into a target structure.
90 Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theInto,
79104795 91 const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
7fd59977 92
93 private:
94 //! Fields
95 TObj_DataMapOfNameLabel myMap; //!< The map of the names
96
97 public:
98 //! CASCADE RTTI
92efcf78 99 DEFINE_STANDARD_RTTIEXT(TObj_TNameContainer,TDF_Attribute)
7fd59977 100};
101
102//! Define handle class for TObj_TObject
103DEFINE_STANDARD_HANDLE(TObj_TNameContainer,TDF_Attribute)
104
105#endif
106
107#ifdef _MSC_VER
108#pragma once
109#endif