1 // Created on: 2012-06-27
2 // Created by: Dmitry BOBYLEV
3 // Copyright (c) 2012-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 #ifndef _TopTools_MutexForShapeProvider_HeaderFile
17 #define _TopTools_MutexForShapeProvider_HeaderFile
19 #include <TopoDS_TShape.hxx>
20 #include <NCollection_DataMap.hxx>
21 #include <TopAbs_ShapeEnum.hxx>
26 //! Class TopTools_MutexForShapeProvider
27 //! This class is used to create and store mutexes associated with shapes.
28 class TopTools_MutexForShapeProvider
32 Standard_EXPORT TopTools_MutexForShapeProvider();
35 Standard_EXPORT ~TopTools_MutexForShapeProvider();
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);
40 //! Creates and associates mutex with theShape
41 Standard_EXPORT void CreateMutexForShape(const TopoDS_Shape& theShape);
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;
47 //! Removes all mutexes
48 Standard_EXPORT void RemoveAllMutexes();
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 &);
57 NCollection_DataMap<Handle(TopoDS_TShape), Standard_Mutex *> myMap;