0024428: Implementation of LGPL license
[occt.git] / src / BOPCol / BOPCol_TBB.hxx
CommitLineData
acccace3 1// Created by: Peter KURNEV
2// Copyright (c) 1999-2013 OPEN CASCADE SAS
3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
acccace3 5//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
acccace3 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
acccace3 14
15#ifndef _BOPDS_Col_HeaderFile
16#define _BOPDS_Col_HeaderFile
17
18#ifdef HAVE_TBB
19
008aef40 20// On Windows, function TryEnterCriticalSection has appeared in Windows NT
21// and is surrounded by #ifdef in MS VC++ 7.1 headers.
22// Thus to use it we need to define appropriate macro saying that we wil
23// run on Windows NT 4.0 at least
24#if ((defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN32_WINNT))
25 #define _WIN32_WINNT 0x0501
26#endif
acccace3 27
28#include <tbb/tbb.h>
29using namespace tbb;
30
19941687 31#define flexible_range blocked_range
32#define flexible_for parallel_for
acccace3 33
19941687 34#else // not HAVE_TBB
35
36#define flexible_range serial_range
37#define flexible_for serial_for
38
39//=======================================================================
40//class : serial_range
41//purpose :
42//=======================================================================
43template <class Type> class serial_range {
44 public:
45 serial_range(const Type& aBegin,
46 const Type& aEnd)
47 : myBegin(aBegin), myEnd(aEnd) {
48 }
49 //
50 ~serial_range() {
51 }
52 //
53 const Type& begin() const{
54 return myBegin;
55 }
56 //
57 const Type& end() const{
58 return myEnd;
59 };
60 //
61 protected:
62 Type myBegin;
63 Type myEnd;
64};
65
66//=======================================================================
67//function : serial_for
68//purpose :
69//=======================================================================
70template<typename Range, typename Body>
71static void serial_for( const Range& range, const Body& body ) {
72 body.operator()(range);
73};
74#endif // not HAVE_TBB
acccace3 75
76#endif