0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / TopTools / TopTools_MutexForShapeProvider.hxx
CommitLineData
6aca4d39 1// Created on: 2012-06-27
d00cba63 2// Created by: Dmitry BOBYLEV
6aca4d39 3// Copyright (c) 2012-2014 OPEN CASCADE SAS
d00cba63 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
d00cba63 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.
d00cba63 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
d00cba63 15
16#ifndef _TopTools_MutexForShapeProvider_HeaderFile
17#define _TopTools_MutexForShapeProvider_HeaderFile
18
cb389a77 19#include <TopoDS_TShape.hxx>
d00cba63 20#include <NCollection_DataMap.hxx>
d00cba63 21#include <TopAbs_ShapeEnum.hxx>
d00cba63 22
f67d0512 23class Standard_Mutex;
24class TopoDS_Shape;
d00cba63 25
26//! Class TopTools_MutexForShapeProvider
27//! This class is used to create and store mutexes associated with shapes.
28class TopTools_MutexForShapeProvider
29{
30public:
31 //! Constructor
32 Standard_EXPORT TopTools_MutexForShapeProvider();
33
34 //! Destructor
35 Standard_EXPORT ~TopTools_MutexForShapeProvider();
36
37 //! Creates and associates mutexes with each sub-shape of type theType in theShape.
38 Standard_EXPORT void CreateMutexesForSubShapes(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType);
39
40 //! Creates and associates mutex with theShape
41 Standard_EXPORT void CreateMutexForShape(const TopoDS_Shape& theShape);
42
43 //! Returns pointer to mutex associated with theShape.
44 //! In case when mutex not found returns NULL.
45 Standard_EXPORT Standard_Mutex* GetMutex(const TopoDS_Shape& theShape) const;
46
47 //! Removes all mutexes
48 Standard_EXPORT void RemoveAllMutexes();
49
50private:
51 //! This method should not be called (prohibited).
52 TopTools_MutexForShapeProvider (const TopTools_MutexForShapeProvider &);
53 //! This method should not be called (prohibited).
54 TopTools_MutexForShapeProvider & operator = (const TopTools_MutexForShapeProvider &);
55
56
857ffd5e 57 NCollection_DataMap<Handle(TopoDS_TShape), Standard_Mutex *> myMap;
d00cba63 58
59};
60
97c4a2fa 61#endif