Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:19

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 Standard_Integer theNode) = 0;
0027 };
0028 
0029 //! Wrapper for BVH build thread.
0030 class BVH_BuildThread : public Standard_Transient
0031 {
0032   template <class T, int N> friend class BVH_QueueBuilder;
0033 
0034 public:
0035 
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()
0041   {
0042     myWorkThread.Run (this);
0043   }
0044 
0045   //! Waits till the thread finishes execution.
0046   void Wait()
0047   {
0048     myWorkThread.Wait();
0049   }
0050 
0051 protected:
0052 
0053   //! Executes BVH build thread.
0054   Standard_EXPORT void execute();
0055 
0056   //! Thread function for BVH build thread.
0057   static Standard_Address threadFunction (Standard_Address theData);
0058 
0059   //! Assignment operator (to remove VC compile warning).
0060   BVH_BuildThread& operator= (const BVH_BuildThread&);
0061 
0062 protected:
0063 
0064   //! Data needed to build the BVH.
0065   BVH_BuildTool& myBuildTool;
0066 
0067   //! Reference to BVH build queue.
0068   BVH_BuildQueue& myBuildQueue;
0069 
0070   //! Thread to execute work items.
0071   OSD_Thread myWorkThread;
0072 
0073 public:
0074 
0075   DEFINE_STANDARD_RTTIEXT(BVH_BuildThread,Standard_Transient)
0076 };
0077 
0078 DEFINE_STANDARD_HANDLE (BVH_BuildThread, Standard_Transient)
0079 
0080 #endif // _BVH_BuildThread_Header