0029702: Foundation Classes - Introduce possibility to control parallel execution...
[occt.git] / src / BVH / BVH_Sorter.hxx
CommitLineData
3c4e78f2 1// Created on: 2014-01-10
2// Created by: Denis BOGOLEPOV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
3c4e78f2 4//
5// This file is part of Open CASCADE Technology software library.
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
3c4e78f2 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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BVH_Sorter_Header
17#define _BVH_Sorter_Header
18
19#include <BVH_Set.hxx>
20
3a507ddb 21//! Tool object to sort abstract primitive set.
3c4e78f2 22template<class T, int N>
23class BVH_Sorter
24{
25public:
26
3c7a61ea 27 //! Performs default initialization.
28 BVH_Sorter()
29 : myIsParallel (Standard_False)
30 { }
31
3a507ddb 32 //! Releases resources of BVH sorter.
33 virtual ~BVH_Sorter() { }
3c4e78f2 34
3a507ddb 35 //! Sorts the set.
36 virtual void Perform (BVH_Set<T, N>* theSet) = 0;
3c4e78f2 37
3a507ddb 38 //! Sorts the given (inclusive) range in the set.
39 virtual void Perform (BVH_Set<T, N>* theSet, const Standard_Integer theStart, const Standard_Integer theFinal) = 0;
3c4e78f2 40
3c7a61ea 41 //! Returns parallel flag.
42 inline Standard_Boolean IsParallel() const
43 {
44 return myIsParallel;
45 }
46
47 //! Set parallel flag contolling possibility of parallel execution.
48 inline void SetParallel(const Standard_Boolean isParallel)
49 {
50 myIsParallel = isParallel;
51 }
52
53private:
54
55 Standard_Boolean myIsParallel;
3a507ddb 56};
3c4e78f2 57
58#endif // _BVH_Sorter_Header