PICCANTE  0.4
The hottest HDR imaging library!
redux_ops.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_UTIL_GL_REDUX_OPS_HPP
19 #define PIC_UTIL_GL_REDUX_OPS_HPP
20 
21 #include <vector>
22 #include <map>
23 #include <thread>
24 #include <mutex>
25 
26 #include "../../util/gl/redux.hpp"
27 
28 namespace pic {
29 
31 
32 typedef std::vector<ReduxGL*> ReduxOperatorsGL;
33 
38 {
39 public:
41 
47  {
48  std::thread::id this_id = std::this_thread::get_id();
49 
50  if(!flag[this_id]) {
51  std::lock_guard<std::mutex> lock(mutex);
52 
53  if(redux_ops_gl[this_id] == NULL) {
54  redux_ops_gl[this_id] = new ReduxOpsGL();
55  flag[this_id] = true;
56  }
57  }
58 
59  return redux_ops_gl[this_id];
60  }
61 
63  {
64  }
65 
66 private:
67  static std::mutex mutex;
68  static std::map<std::thread::id, bool> flag;
69  static std::map<std::thread::id, ReduxOpsGL*> redux_ops_gl;
70 
74  ReduxOpsGL()
75  {
76  list.push_back(ReduxGL::createMin());
77  list.push_back(ReduxGL::createMax());
78  list.push_back(ReduxGL::createSum());
79  list.push_back(ReduxGL::createMean());
80  list.push_back(ReduxGL::createLogMean());
81  }
82 
83 };
84 
85 std::mutex ReduxOpsGL::mutex;
86 
87 std::map<std::thread::id, bool> ReduxOpsGL::flag;
88 
89 std::map<std::thread::id, ReduxOpsGL*> ReduxOpsGL::redux_ops_gl;
90 
91 } // end namespace pic
92 
93 #endif /* PIC_UTIL_GL_REDUX_OPS_HPP */
Definition: redux_ops.hpp:30
static ReduxGL * createSum()
createSum
Definition: redux.hpp:120
static ReduxGL * createLogMean()
createLogMean
Definition: redux.hpp:131
Definition: redux_ops.hpp:30
static ReduxGL * createMean()
createMean
Definition: redux.hpp:109
~ReduxOpsGL()
Definition: redux_ops.hpp:62
Definition: redux_ops.hpp:30
Definition: redux_ops.hpp:30
The BufferOpsGL class.
Definition: redux_ops.hpp:37
static ReduxGL * createMax()
createMax
Definition: redux.hpp:155
static ReduxGL * createMin()
createMin
Definition: redux.hpp:142
REDGL
Definition: redux_ops.hpp:30
Definition: redux_ops.hpp:30
ReduxOperatorsGL list
Definition: redux_ops.hpp:40
Definition: bilateral_separation.hpp:25
std::vector< ReduxGL * > ReduxOperatorsGL
Definition: redux_ops.hpp:32
static ReduxOpsGL * getInstance()
getInstance
Definition: redux_ops.hpp:46