Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:19:57

0001 // Created on: 2015-05-29
0002 // Created by: Denis BOGOLEPOV
0003 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BVH_BuildThread_Header
0017 #define _BVH_BuildThread_Header
0018 
0019 #include <OSD_Thread.hxx>
0020 #include <BVH_BuildQueue.hxx>
0021 
0022 //! Tool object to call BVH builder subroutines.
0023 struct BVH_BuildTool
0024 {
0025   //! Performs splitting of the given BVH node.
0026   virtual void Perform(const int theNode) = 0;
0027 };
0028 
0029 //! Wrapper for BVH build thread.
0030 class BVH_BuildThread : public Standard_Transient
0031 {
0032   template <class T, int N>
0033   friend class BVH_QueueBuilder;
0034 
0035 public:
0036   //! Creates new BVH build thread.
0037   Standard_EXPORT BVH_BuildThread(BVH_BuildTool& theBuildTool, BVH_BuildQueue& theBuildQueue);
0038 
0039   //! Starts execution of BVH build thread.
0040   void Run() { myWorkThread.Run(this); }
0041 
0042   //! Waits till the thread finishes execution.
0043   void Wait() { myWorkThread.Wait(); }
0044 
0045 protected:
0046   //! Executes BVH build thread.
0047   Standard_EXPORT void execute();
0048 
0049   //! Thread function for BVH build thread.
0050   static void* threadFunction(void* theData);
0051 
0052   //! Assignment operator (to remove VC compile warning).
0053   BVH_BuildThread& operator=(const BVH_BuildThread&);
0054 
0055 protected:
0056   //! Data needed to build the BVH.
0057   BVH_BuildTool& myBuildTool;
0058 
0059   //! Reference to BVH build queue.
0060   BVH_BuildQueue& myBuildQueue;
0061 
0062   //! Thread to execute work items.
0063   OSD_Thread myWorkThread;
0064 
0065 public:
0066   DEFINE_STANDARD_RTTIEXT(BVH_BuildThread, Standard_Transient)
0067 };
0068 
0069 #endif // _BVH_BuildThread_Header