node-native-win-utils 1.4.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +29 -82
  2. package/binding.gyp +2 -0
  3. package/dist/dirnameLocal.cjs +4 -0
  4. package/dist/dirnameLocal.d.cts +1 -0
  5. package/dist/dirnameLocal.d.mts +1 -0
  6. package/dist/dirnameLocal.mjs +2 -0
  7. package/dist/{index.js → index.cjs} +83 -16
  8. package/dist/{index.d.ts → index.d.cts} +68 -17
  9. package/dist/index.d.mts +230 -0
  10. package/dist/index.mjs +212 -0
  11. package/dist/keyCodes.d.mts +101 -0
  12. package/dist/keyCodes.mjs +201 -0
  13. package/node22.json +16 -0
  14. package/package.json +19 -9
  15. package/prebuilds/win32-x64/node-native-win-utils.node +0 -0
  16. package/src/cpp/keyboard.cpp +141 -140
  17. package/src/cpp/main.cpp +9 -3
  18. package/src/cpp/{capturewindow.cpp → screenshot.cpp} +174 -2
  19. package/src/dirnameLocal.mts +3 -0
  20. package/src/index.mts +455 -0
  21. package/src/keyCodes.mts +203 -0
  22. package/dllCopy.js +0 -14
  23. package/include/opencv2/core/affine.hpp +0 -678
  24. package/include/opencv2/core/async.hpp +0 -105
  25. package/include/opencv2/core/base.hpp +0 -664
  26. package/include/opencv2/core/bindings_utils.hpp +0 -325
  27. package/include/opencv2/core/bufferpool.hpp +0 -40
  28. package/include/opencv2/core/check.hpp +0 -170
  29. package/include/opencv2/core/core.hpp +0 -48
  30. package/include/opencv2/core/core_c.h +0 -3128
  31. package/include/opencv2/core/cuda/block.hpp +0 -211
  32. package/include/opencv2/core/cuda/border_interpolate.hpp +0 -722
  33. package/include/opencv2/core/cuda/color.hpp +0 -309
  34. package/include/opencv2/core/cuda/common.hpp +0 -131
  35. package/include/opencv2/core/cuda/datamov_utils.hpp +0 -113
  36. package/include/opencv2/core/cuda/detail/color_detail.hpp +0 -2018
  37. package/include/opencv2/core/cuda/detail/reduce.hpp +0 -365
  38. package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +0 -502
  39. package/include/opencv2/core/cuda/detail/transform_detail.hpp +0 -392
  40. package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +0 -191
  41. package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +0 -121
  42. package/include/opencv2/core/cuda/dynamic_smem.hpp +0 -88
  43. package/include/opencv2/core/cuda/emulation.hpp +0 -269
  44. package/include/opencv2/core/cuda/filters.hpp +0 -293
  45. package/include/opencv2/core/cuda/funcattrib.hpp +0 -79
  46. package/include/opencv2/core/cuda/functional.hpp +0 -805
  47. package/include/opencv2/core/cuda/limits.hpp +0 -128
  48. package/include/opencv2/core/cuda/reduce.hpp +0 -209
  49. package/include/opencv2/core/cuda/saturate_cast.hpp +0 -292
  50. package/include/opencv2/core/cuda/scan.hpp +0 -258
  51. package/include/opencv2/core/cuda/simd_functions.hpp +0 -869
  52. package/include/opencv2/core/cuda/transform.hpp +0 -75
  53. package/include/opencv2/core/cuda/type_traits.hpp +0 -90
  54. package/include/opencv2/core/cuda/utility.hpp +0 -230
  55. package/include/opencv2/core/cuda/vec_distance.hpp +0 -232
  56. package/include/opencv2/core/cuda/vec_math.hpp +0 -923
  57. package/include/opencv2/core/cuda/vec_traits.hpp +0 -288
  58. package/include/opencv2/core/cuda/warp.hpp +0 -139
  59. package/include/opencv2/core/cuda/warp_reduce.hpp +0 -76
  60. package/include/opencv2/core/cuda/warp_shuffle.hpp +0 -162
  61. package/include/opencv2/core/cuda.hpp +0 -1279
  62. package/include/opencv2/core/cuda.inl.hpp +0 -763
  63. package/include/opencv2/core/cuda_stream_accessor.hpp +0 -86
  64. package/include/opencv2/core/cuda_types.hpp +0 -144
  65. package/include/opencv2/core/cv_cpu_dispatch.h +0 -381
  66. package/include/opencv2/core/cv_cpu_helper.h +0 -550
  67. package/include/opencv2/core/cvdef.h +0 -973
  68. package/include/opencv2/core/cvstd.hpp +0 -190
  69. package/include/opencv2/core/cvstd.inl.hpp +0 -197
  70. package/include/opencv2/core/cvstd_wrapper.hpp +0 -154
  71. package/include/opencv2/core/detail/async_promise.hpp +0 -71
  72. package/include/opencv2/core/detail/dispatch_helper.impl.hpp +0 -49
  73. package/include/opencv2/core/detail/exception_ptr.hpp +0 -27
  74. package/include/opencv2/core/directx.hpp +0 -184
  75. package/include/opencv2/core/dualquaternion.hpp +0 -979
  76. package/include/opencv2/core/dualquaternion.inl.hpp +0 -487
  77. package/include/opencv2/core/eigen.hpp +0 -402
  78. package/include/opencv2/core/fast_math.hpp +0 -433
  79. package/include/opencv2/core/hal/hal.hpp +0 -256
  80. package/include/opencv2/core/hal/interface.h +0 -190
  81. package/include/opencv2/core/hal/intrin.hpp +0 -939
  82. package/include/opencv2/core/hal/intrin_avx.hpp +0 -3177
  83. package/include/opencv2/core/hal/intrin_avx512.hpp +0 -3090
  84. package/include/opencv2/core/hal/intrin_cpp.hpp +0 -3321
  85. package/include/opencv2/core/hal/intrin_forward.hpp +0 -191
  86. package/include/opencv2/core/hal/intrin_lasx.hpp +0 -3236
  87. package/include/opencv2/core/hal/intrin_msa.hpp +0 -1887
  88. package/include/opencv2/core/hal/intrin_neon.hpp +0 -2610
  89. package/include/opencv2/core/hal/intrin_rvv.hpp +0 -3320
  90. package/include/opencv2/core/hal/intrin_rvv071.hpp +0 -2545
  91. package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +0 -2080
  92. package/include/opencv2/core/hal/intrin_sse.hpp +0 -3467
  93. package/include/opencv2/core/hal/intrin_sse_em.hpp +0 -180
  94. package/include/opencv2/core/hal/intrin_vsx.hpp +0 -1608
  95. package/include/opencv2/core/hal/intrin_wasm.hpp +0 -2782
  96. package/include/opencv2/core/hal/msa_macros.h +0 -1558
  97. package/include/opencv2/core/hal/simd_utils.impl.hpp +0 -186
  98. package/include/opencv2/core/llapi/llapi.h +0 -102
  99. package/include/opencv2/core/mat.hpp +0 -3775
  100. package/include/opencv2/core/mat.inl.hpp +0 -3422
  101. package/include/opencv2/core/matx.hpp +0 -1536
  102. package/include/opencv2/core/neon_utils.hpp +0 -128
  103. package/include/opencv2/core/ocl.hpp +0 -917
  104. package/include/opencv2/core/ocl_genbase.hpp +0 -69
  105. package/include/opencv2/core/opencl/ocl_defs.hpp +0 -82
  106. package/include/opencv2/core/opencl/opencl_info.hpp +0 -212
  107. package/include/opencv2/core/opencl/opencl_svm.hpp +0 -81
  108. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +0 -602
  109. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +0 -146
  110. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +0 -371
  111. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +0 -272
  112. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +0 -62
  113. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +0 -42
  114. package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +0 -53
  115. package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +0 -53
  116. package/include/opencv2/core/opencl/runtime/opencl_core.hpp +0 -84
  117. package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +0 -47
  118. package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +0 -53
  119. package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +0 -47
  120. package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +0 -48
  121. package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +0 -42
  122. package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +0 -166
  123. package/include/opencv2/core/opengl.hpp +0 -733
  124. package/include/opencv2/core/openvx/ovx_defs.hpp +0 -48
  125. package/include/opencv2/core/operations.hpp +0 -610
  126. package/include/opencv2/core/optim.hpp +0 -302
  127. package/include/opencv2/core/ovx.hpp +0 -28
  128. package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +0 -72
  129. package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +0 -153
  130. package/include/opencv2/core/parallel/parallel_backend.hpp +0 -90
  131. package/include/opencv2/core/persistence.hpp +0 -1350
  132. package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +0 -30
  133. package/include/opencv2/core/private.cuda.hpp +0 -169
  134. package/include/opencv2/core/private.hpp +0 -896
  135. package/include/opencv2/core/quaternion.hpp +0 -1696
  136. package/include/opencv2/core/quaternion.inl.hpp +0 -1063
  137. package/include/opencv2/core/saturate.hpp +0 -180
  138. package/include/opencv2/core/simd_intrinsics.hpp +0 -87
  139. package/include/opencv2/core/softfloat.hpp +0 -514
  140. package/include/opencv2/core/sse_utils.hpp +0 -652
  141. package/include/opencv2/core/traits.hpp +0 -417
  142. package/include/opencv2/core/types.hpp +0 -2457
  143. package/include/opencv2/core/types_c.h +0 -2126
  144. package/include/opencv2/core/utility.hpp +0 -1229
  145. package/include/opencv2/core/utils/allocator_stats.hpp +0 -29
  146. package/include/opencv2/core/utils/allocator_stats.impl.hpp +0 -158
  147. package/include/opencv2/core/utils/buffer_area.private.hpp +0 -136
  148. package/include/opencv2/core/utils/configuration.private.hpp +0 -22
  149. package/include/opencv2/core/utils/filesystem.hpp +0 -82
  150. package/include/opencv2/core/utils/filesystem.private.hpp +0 -66
  151. package/include/opencv2/core/utils/fp_control.private.hpp +0 -29
  152. package/include/opencv2/core/utils/fp_control_utils.hpp +0 -69
  153. package/include/opencv2/core/utils/instrumentation.hpp +0 -125
  154. package/include/opencv2/core/utils/lock.private.hpp +0 -119
  155. package/include/opencv2/core/utils/logger.defines.hpp +0 -42
  156. package/include/opencv2/core/utils/logger.hpp +0 -218
  157. package/include/opencv2/core/utils/logtag.hpp +0 -28
  158. package/include/opencv2/core/utils/plugin_loader.private.hpp +0 -165
  159. package/include/opencv2/core/utils/tls.hpp +0 -235
  160. package/include/opencv2/core/utils/trace.hpp +0 -252
  161. package/include/opencv2/core/utils/trace.private.hpp +0 -421
  162. package/include/opencv2/core/va_intel.hpp +0 -75
  163. package/include/opencv2/core/version.hpp +0 -26
  164. package/include/opencv2/core/vsx_utils.hpp +0 -1047
  165. package/include/opencv2/core.hpp +0 -3365
  166. package/include/opencv2/imgcodecs/imgcodecs.hpp +0 -48
  167. package/include/opencv2/imgcodecs/imgcodecs_c.h +0 -1
  168. package/include/opencv2/imgcodecs/ios.h +0 -59
  169. package/include/opencv2/imgcodecs/legacy/constants_c.h +0 -54
  170. package/include/opencv2/imgcodecs/macosx.h +0 -20
  171. package/include/opencv2/imgcodecs.hpp +0 -407
  172. package/include/opencv2/imgproc/bindings.hpp +0 -34
  173. package/include/opencv2/imgproc/detail/gcgraph.hpp +0 -395
  174. package/include/opencv2/imgproc/hal/hal.hpp +0 -246
  175. package/include/opencv2/imgproc/hal/interface.h +0 -46
  176. package/include/opencv2/imgproc/imgproc.hpp +0 -48
  177. package/include/opencv2/imgproc/imgproc_c.h +0 -1177
  178. package/include/opencv2/imgproc/segmentation.hpp +0 -141
  179. package/include/opencv2/imgproc/types_c.h +0 -659
  180. package/include/opencv2/imgproc.hpp +0 -5035
  181. package/include/opencv2/opencv_modules.hpp +0 -17
  182. package/include/tesseract/baseapi.h +0 -820
  183. package/include/tesseract/capi.h +0 -485
  184. package/include/tesseract/export.h +0 -37
  185. package/include/tesseract/ltrresultiterator.h +0 -235
  186. package/include/tesseract/ocrclass.h +0 -158
  187. package/include/tesseract/osdetect.h +0 -139
  188. package/include/tesseract/pageiterator.h +0 -364
  189. package/include/tesseract/publictypes.h +0 -281
  190. package/include/tesseract/renderer.h +0 -334
  191. package/include/tesseract/resultiterator.h +0 -250
  192. package/include/tesseract/tesseract.h +0 -40
  193. package/include/tesseract/unichar.h +0 -174
  194. package/include/tesseract/version.h +0 -34
  195. package/include/tesseract/version.h.in +0 -34
  196. package/libs/libjpeg-turbo.lib +0 -0
  197. package/libs/libpng.lib +0 -0
  198. package/libs/opencv_core470.lib +0 -0
  199. package/libs/opencv_imgcodecs470.lib +0 -0
  200. package/libs/opencv_imgproc470.lib +0 -0
  201. package/libs/tesseract.lib +0 -0
  202. package/libs/zlib.lib +0 -0
  203. /package/dist/{keyCodes.js → keyCodes.cjs} +0 -0
  204. /package/dist/{keyCodes.d.ts → keyCodes.d.cts} +0 -0
@@ -1,235 +0,0 @@
1
- // This file is part of OpenCV project.
2
- // It is subject to the license terms in the LICENSE file found in the top-level directory
3
- // of this distribution and at http://opencv.org/license.html.
4
-
5
- #ifndef OPENCV_UTILS_TLS_HPP
6
- #define OPENCV_UTILS_TLS_HPP
7
-
8
- #ifndef OPENCV_CORE_UTILITY_H
9
- #error "tls.hpp must be included after opencv2/core/utility.hpp or opencv2/core.hpp"
10
- #endif
11
-
12
- namespace cv {
13
-
14
- //! @addtogroup core_utils
15
- //! @{
16
-
17
- namespace details { class TlsStorage; }
18
-
19
- /** TLS container base implementation
20
- *
21
- * Don't use directly.
22
- *
23
- * @sa TLSData, TLSDataAccumulator templates
24
- */
25
- class CV_EXPORTS TLSDataContainer
26
- {
27
- protected:
28
- TLSDataContainer();
29
- virtual ~TLSDataContainer();
30
-
31
- /// @deprecated use detachData() instead
32
- void gatherData(std::vector<void*> &data) const;
33
- /// get TLS data and detach all data from threads (similar to cleanup() call)
34
- void detachData(std::vector<void*>& data);
35
-
36
- void* getData() const;
37
- void release();
38
-
39
- protected:
40
- virtual void* createDataInstance() const = 0;
41
- virtual void deleteDataInstance(void* pData) const = 0;
42
-
43
- private:
44
- int key_;
45
-
46
- friend class cv::details::TlsStorage; // core/src/system.cpp
47
-
48
- public:
49
- void cleanup(); //!< Release created TLS data container objects. It is similar to release() call, but it keeps TLS container valid.
50
-
51
- private:
52
- // Disable copy/assign (noncopyable pattern)
53
- TLSDataContainer(TLSDataContainer &) = delete;
54
- TLSDataContainer& operator =(const TLSDataContainer &) = delete;
55
- };
56
-
57
-
58
- /** @brief Simple TLS data class
59
- *
60
- * @sa TLSDataAccumulator
61
- */
62
- template <typename T>
63
- class TLSData : protected TLSDataContainer
64
- {
65
- public:
66
- inline TLSData() {}
67
- inline ~TLSData() { release(); }
68
-
69
- inline T* get() const { return (T*)getData(); } //!< Get data associated with key
70
- inline T& getRef() const { T* ptr = (T*)getData(); CV_DbgAssert(ptr); return *ptr; } //!< Get data associated with key
71
-
72
- /// Release associated thread data
73
- inline void cleanup()
74
- {
75
- TLSDataContainer::cleanup();
76
- }
77
-
78
- protected:
79
- /// Wrapper to allocate data by template
80
- virtual void* createDataInstance() const CV_OVERRIDE { return new T; }
81
- /// Wrapper to release data by template
82
- virtual void deleteDataInstance(void* pData) const CV_OVERRIDE { delete (T*)pData; }
83
- };
84
-
85
-
86
- /// TLS data accumulator with gathering methods
87
- template <typename T>
88
- class TLSDataAccumulator : public TLSData<T>
89
- {
90
- mutable cv::Mutex mutex;
91
- mutable std::vector<T*> dataFromTerminatedThreads;
92
- std::vector<T*> detachedData;
93
- bool cleanupMode;
94
- public:
95
- TLSDataAccumulator() : cleanupMode(false) {}
96
- ~TLSDataAccumulator()
97
- {
98
- release();
99
- }
100
-
101
- /** @brief Get data from all threads
102
- * @deprecated replaced by detachData()
103
- *
104
- * Lifetime of vector data is valid until next detachData()/cleanup()/release() calls
105
- *
106
- * @param[out] data result buffer (should be empty)
107
- */
108
- void gather(std::vector<T*> &data) const
109
- {
110
- CV_Assert(cleanupMode == false); // state is not valid
111
- CV_Assert(data.empty());
112
- {
113
- std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
114
- TLSDataContainer::gatherData(dataVoid);
115
- }
116
- {
117
- AutoLock lock(mutex);
118
- data.reserve(data.size() + dataFromTerminatedThreads.size());
119
- for (typename std::vector<T*>::const_iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
120
- {
121
- data.push_back((T*)*i);
122
- }
123
- }
124
- }
125
-
126
- /** @brief Get and detach data from all threads
127
- *
128
- * Call cleanupDetachedData() when returned vector is not needed anymore.
129
- *
130
- * @return Vector with associated data. Content is preserved (including lifetime of attached data pointers) until next detachData()/cleanupDetachedData()/cleanup()/release() calls
131
- */
132
- std::vector<T*>& detachData()
133
- {
134
- CV_Assert(cleanupMode == false); // state is not valid
135
- std::vector<void*> dataVoid;
136
- {
137
- TLSDataContainer::detachData(dataVoid);
138
- }
139
- {
140
- AutoLock lock(mutex);
141
- detachedData.reserve(dataVoid.size() + dataFromTerminatedThreads.size());
142
- for (typename std::vector<T*>::const_iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
143
- {
144
- detachedData.push_back((T*)*i);
145
- }
146
- dataFromTerminatedThreads.clear();
147
- for (typename std::vector<void*>::const_iterator i = dataVoid.begin(); i != dataVoid.end(); ++i)
148
- {
149
- detachedData.push_back((T*)(void*)*i);
150
- }
151
- }
152
- dataVoid.clear();
153
- return detachedData;
154
- }
155
-
156
- /// Release associated thread data returned by detachData() call
157
- void cleanupDetachedData()
158
- {
159
- AutoLock lock(mutex);
160
- cleanupMode = true;
161
- _cleanupDetachedData();
162
- cleanupMode = false;
163
- }
164
-
165
- /// Release associated thread data
166
- void cleanup()
167
- {
168
- cleanupMode = true;
169
- TLSDataContainer::cleanup();
170
-
171
- AutoLock lock(mutex);
172
- _cleanupDetachedData();
173
- _cleanupTerminatedData();
174
- cleanupMode = false;
175
- }
176
-
177
- /// Release associated thread data and free TLS key
178
- void release()
179
- {
180
- cleanupMode = true;
181
- TLSDataContainer::release();
182
- {
183
- AutoLock lock(mutex);
184
- _cleanupDetachedData();
185
- _cleanupTerminatedData();
186
- }
187
- }
188
-
189
- protected:
190
- // synchronized
191
- void _cleanupDetachedData()
192
- {
193
- for (typename std::vector<T*>::iterator i = detachedData.begin(); i != detachedData.end(); ++i)
194
- {
195
- deleteDataInstance((T*)*i);
196
- }
197
- detachedData.clear();
198
- }
199
-
200
- // synchronized
201
- void _cleanupTerminatedData()
202
- {
203
- for (typename std::vector<T*>::iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
204
- {
205
- deleteDataInstance((T*)*i);
206
- }
207
- dataFromTerminatedThreads.clear();
208
- }
209
-
210
- protected:
211
- virtual void* createDataInstance() const CV_OVERRIDE
212
- {
213
- // Note: we can collect all allocated data here, but this would require raced mutex locks
214
- return new T;
215
- }
216
- virtual void deleteDataInstance(void* pData) const CV_OVERRIDE
217
- {
218
- if (cleanupMode)
219
- {
220
- delete (T*)pData;
221
- }
222
- else
223
- {
224
- AutoLock lock(mutex);
225
- dataFromTerminatedThreads.push_back((T*)pData);
226
- }
227
- }
228
- };
229
-
230
-
231
- //! @}
232
-
233
- } // namespace
234
-
235
- #endif // OPENCV_UTILS_TLS_HPP
@@ -1,252 +0,0 @@
1
- // This file is part of OpenCV project.
2
- // It is subject to the license terms in the LICENSE file found in the top-level directory
3
- // of this distribution and at http://opencv.org/license.html.
4
-
5
- #ifndef OPENCV_TRACE_HPP
6
- #define OPENCV_TRACE_HPP
7
-
8
- #include <opencv2/core/cvdef.h>
9
-
10
- namespace cv {
11
- namespace utils {
12
- namespace trace {
13
-
14
- //! @addtogroup core_logging
15
- //! @{
16
-
17
- //! Macro to trace function
18
- #define CV_TRACE_FUNCTION()
19
-
20
- #define CV_TRACE_FUNCTION_SKIP_NESTED()
21
-
22
- //! Trace code scope.
23
- //! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "initialize".
24
- #define CV_TRACE_REGION(name_as_static_string_literal)
25
- //! mark completed of the current opened region and create new one
26
- //! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "step1".
27
- #define CV_TRACE_REGION_NEXT(name_as_static_string_literal)
28
-
29
- //! Macro to trace argument value
30
- #define CV_TRACE_ARG(arg_id)
31
-
32
- //! Macro to trace argument value (expanded version)
33
- #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value)
34
-
35
- //! @cond IGNORED
36
- #define CV_TRACE_NS cv::utils::trace
37
-
38
- #if !defined(OPENCV_DISABLE_TRACE) && defined(__EMSCRIPTEN__)
39
- #define OPENCV_DISABLE_TRACE 1
40
- #endif
41
-
42
- namespace details {
43
-
44
- #ifndef __OPENCV_TRACE
45
- # if defined __OPENCV_BUILD && !defined __OPENCV_TESTS && !defined __OPENCV_APPS
46
- # define __OPENCV_TRACE 1
47
- # else
48
- # define __OPENCV_TRACE 0
49
- # endif
50
- #endif
51
-
52
- #ifndef CV_TRACE_FILENAME
53
- # define CV_TRACE_FILENAME __FILE__
54
- #endif
55
-
56
- #ifndef CV__TRACE_FUNCTION
57
- # if defined _MSC_VER
58
- # define CV__TRACE_FUNCTION __FUNCSIG__
59
- # elif defined __GNUC__
60
- # define CV__TRACE_FUNCTION __PRETTY_FUNCTION__
61
- # else
62
- # define CV__TRACE_FUNCTION "<unknown>"
63
- # endif
64
- #endif
65
-
66
- //! Thread-local instance (usually allocated on stack)
67
- class CV_EXPORTS Region
68
- {
69
- public:
70
- struct LocationExtraData;
71
- struct LocationStaticStorage
72
- {
73
- LocationExtraData** ppExtra; //< implementation specific data
74
- const char* name; //< region name (function name or other custom name)
75
- const char* filename; //< source code filename
76
- int line; //< source code line
77
- int flags; //< flags (implementation code path: Plain, IPP, OpenCL)
78
- };
79
-
80
- Region(const LocationStaticStorage& location);
81
- inline ~Region()
82
- {
83
- if (implFlags != 0)
84
- destroy();
85
- CV_DbgAssert(implFlags == 0);
86
- CV_DbgAssert(pImpl == NULL);
87
- }
88
-
89
- class Impl;
90
- Impl* pImpl; // NULL if current region is not active
91
- int implFlags; // see RegionFlag, 0 if region is ignored
92
-
93
- bool isActive() const { return pImpl != NULL; }
94
-
95
- void destroy();
96
- private:
97
- Region(const Region&); // disabled
98
- Region& operator= (const Region&); // disabled
99
- };
100
-
101
- //! Specify region flags
102
- enum RegionLocationFlag {
103
- REGION_FLAG_FUNCTION = (1 << 0), //< region is function (=1) / nested named region (=0)
104
- REGION_FLAG_APP_CODE = (1 << 1), //< region is Application code (=1) / OpenCV library code (=0)
105
- REGION_FLAG_SKIP_NESTED = (1 << 2), //< avoid processing of nested regions
106
-
107
- REGION_FLAG_IMPL_IPP = (1 << 16), //< region is part of IPP code path
108
- REGION_FLAG_IMPL_OPENCL = (2 << 16), //< region is part of OpenCL code path
109
- REGION_FLAG_IMPL_OPENVX = (3 << 16), //< region is part of OpenVX code path
110
-
111
- REGION_FLAG_IMPL_MASK = (15 << 16),
112
-
113
- REGION_FLAG_REGION_FORCE = (1 << 30),
114
- REGION_FLAG_REGION_NEXT = (1 << 31), //< close previous region (see #CV_TRACE_REGION_NEXT macro)
115
-
116
- ENUM_REGION_FLAG_FORCE_INT = INT_MAX
117
- };
118
-
119
- struct CV_EXPORTS TraceArg {
120
- public:
121
- struct ExtraData;
122
- ExtraData** ppExtra;
123
- const char* name;
124
- int flags;
125
- };
126
- /** @brief Add meta information to current region (function)
127
- * See CV_TRACE_ARG macro
128
- * @param arg argument information structure (global static cache)
129
- * @param value argument value (can by dynamic string literal in case of string, static allocation is not required)
130
- */
131
- CV_EXPORTS void traceArg(const TraceArg& arg, const char* value);
132
- //! @overload
133
- CV_EXPORTS void traceArg(const TraceArg& arg, int value);
134
- //! @overload
135
- CV_EXPORTS void traceArg(const TraceArg& arg, int64 value);
136
- //! @overload
137
- CV_EXPORTS void traceArg(const TraceArg& arg, double value);
138
-
139
- #define CV__TRACE_LOCATION_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_, loc_id), __LINE__)
140
- #define CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_extra_, loc_id) , __LINE__)
141
-
142
- #define CV__TRACE_DEFINE_LOCATION_(loc_id, name, flags) \
143
- static CV_TRACE_NS::details::Region::LocationExtraData* CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) = 0; \
144
- static const CV_TRACE_NS::details::Region::LocationStaticStorage \
145
- CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags};
146
-
147
- #define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, ((flags) | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
148
-
149
-
150
- #define CV__TRACE_OPENCV_FUNCTION() \
151
- CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, 0); \
152
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
153
-
154
- #define CV__TRACE_OPENCV_FUNCTION_NAME(name) \
155
- CV__TRACE_DEFINE_LOCATION_FN(name, 0); \
156
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
157
-
158
- #define CV__TRACE_APP_FUNCTION() \
159
- CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
160
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
161
-
162
- #define CV__TRACE_APP_FUNCTION_NAME(name) \
163
- CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
164
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
165
-
166
-
167
- #define CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED() \
168
- CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
169
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
170
-
171
- #define CV__TRACE_OPENCV_FUNCTION_NAME_SKIP_NESTED(name) \
172
- CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
173
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
174
-
175
- #define CV__TRACE_APP_FUNCTION_SKIP_NESTED() \
176
- CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED | CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
177
- const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
178
-
179
-
180
- #define CV__TRACE_REGION_(name_as_static_string_literal, flags) \
181
- CV__TRACE_DEFINE_LOCATION_(region, name_as_static_string_literal, flags); \
182
- CV_TRACE_NS::details::Region CVAUX_CONCAT(__region_, __LINE__)(CV__TRACE_LOCATION_VARNAME(region));
183
-
184
- #define CV__TRACE_REGION(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, 0)
185
- #define CV__TRACE_REGION_NEXT(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, CV_TRACE_NS::details::REGION_FLAG_REGION_NEXT)
186
-
187
- #define CV__TRACE_ARG_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_ ## arg_id, __LINE__)
188
- #define CV__TRACE_ARG_EXTRA_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_extra_ ## arg_id, __LINE__)
189
-
190
- #define CV__TRACE_DEFINE_ARG_(arg_id, name, flags) \
191
- static CV_TRACE_NS::details::TraceArg::ExtraData* CV__TRACE_ARG_EXTRA_VARNAME(arg_id) = 0; \
192
- static const CV_TRACE_NS::details::TraceArg \
193
- CV__TRACE_ARG_VARNAME(arg_id) = { &(CV__TRACE_ARG_EXTRA_VARNAME(arg_id)), name, flags };
194
-
195
- #define CV__TRACE_ARG_VALUE(arg_id, arg_name, value) \
196
- CV__TRACE_DEFINE_ARG_(arg_id, arg_name, 0); \
197
- CV_TRACE_NS::details::traceArg((CV__TRACE_ARG_VARNAME(arg_id)), value);
198
-
199
- #define CV__TRACE_ARG(arg_id) CV_TRACE_ARG_VALUE(arg_id, #arg_id, (arg_id))
200
-
201
- } // namespace
202
-
203
- #ifndef OPENCV_DISABLE_TRACE
204
- #undef CV_TRACE_FUNCTION
205
- #undef CV_TRACE_FUNCTION_SKIP_NESTED
206
- #if __OPENCV_TRACE
207
- #define CV_TRACE_FUNCTION CV__TRACE_OPENCV_FUNCTION
208
- #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED
209
- #else
210
- #define CV_TRACE_FUNCTION CV__TRACE_APP_FUNCTION
211
- #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_APP_FUNCTION_SKIP_NESTED
212
- #endif
213
-
214
- #undef CV_TRACE_REGION
215
- #define CV_TRACE_REGION CV__TRACE_REGION
216
-
217
- #undef CV_TRACE_REGION_NEXT
218
- #define CV_TRACE_REGION_NEXT CV__TRACE_REGION_NEXT
219
-
220
- #undef CV_TRACE_ARG_VALUE
221
- #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) \
222
- if (__region_fn.isActive()) \
223
- { \
224
- CV__TRACE_ARG_VALUE(arg_id, arg_name, value); \
225
- }
226
-
227
- #undef CV_TRACE_ARG
228
- #define CV_TRACE_ARG CV__TRACE_ARG
229
-
230
- #endif // OPENCV_DISABLE_TRACE
231
-
232
- #ifdef OPENCV_TRACE_VERBOSE
233
- #define CV_TRACE_FUNCTION_VERBOSE CV_TRACE_FUNCTION
234
- #define CV_TRACE_REGION_VERBOSE CV_TRACE_REGION
235
- #define CV_TRACE_REGION_NEXT_VERBOSE CV_TRACE_REGION_NEXT
236
- #define CV_TRACE_ARG_VALUE_VERBOSE CV_TRACE_ARG_VALUE
237
- #define CV_TRACE_ARG_VERBOSE CV_TRACE_ARG
238
- #else
239
- #define CV_TRACE_FUNCTION_VERBOSE(...)
240
- #define CV_TRACE_REGION_VERBOSE(...)
241
- #define CV_TRACE_REGION_NEXT_VERBOSE(...)
242
- #define CV_TRACE_ARG_VALUE_VERBOSE(...)
243
- #define CV_TRACE_ARG_VERBOSE(...)
244
- #endif
245
-
246
- //! @endcond
247
-
248
- //! @}
249
-
250
- }}} // namespace
251
-
252
- #endif // OPENCV_TRACE_HPP