1 // Created on: 2015-05-29
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-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 _BVH_BuildThread_Header
17 #define _BVH_BuildThread_Header
19 #include <OSD_Thread.hxx>
20 #include <BVH_BuildQueue.hxx>
22 //! Tool object to call BVH builder subroutines.
25 //! Performs splitting of the given BVH node.
26 virtual void Perform (const Standard_Integer theNode) = 0;
29 //! Wrapper for BVH build thread.
30 class BVH_BuildThread : public Standard_Transient
32 template <class T, int N> friend class BVH_QueueBuilder;
36 //! Creates new BVH build thread.
37 Standard_EXPORT BVH_BuildThread (BVH_BuildTool& theBuildTool, BVH_BuildQueue& theBuildQueue);
39 //! Starts execution of BVH build thread.
42 myWorkThread.Run (this);
45 //! Waits till the thread finishes execution.
53 //! Executes BVH build thread.
54 Standard_EXPORT void execute();
56 //! Thread function for BVH build thread.
57 static Standard_Address threadFunction (Standard_Address theData);
59 //! Assignment operator (to remove VC compile warning).
60 BVH_BuildThread& operator= (const BVH_BuildThread&);
64 //! Data needed to build the BVH.
65 BVH_BuildTool& myBuildTool;
67 //! Reference to BVH build queue.
68 BVH_BuildQueue& myBuildQueue;
70 //! Thread to execute work items.
71 OSD_Thread myWorkThread;
75 DEFINE_STANDARD_RTTIEXT(BVH_BuildThread,Standard_Transient)
78 DEFINE_STANDARD_HANDLE (BVH_BuildThread, Standard_Transient)
80 #endif // _BVH_BuildThread_Header