node-native-win-utils 1.3.4 → 2.1.0

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 (191) hide show
  1. package/README.md +30 -83
  2. package/binding.gyp +3 -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} +49 -17
  8. package/dist/{index.d.ts → index.d.cts} +25 -12
  9. package/dist/index.d.mts +191 -0
  10. package/dist/index.mjs +177 -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 +22 -9
  15. package/prebuilds/win32-x64/node-native-win-utils.node +0 -0
  16. package/prebuilds/win32-x64/tesseract.dll +0 -0
  17. package/prebuilds/win32-x64/tiff.dll +0 -0
  18. package/src/cpp/keyboard.cpp +141 -140
  19. package/src/cpp/main.cpp +11 -3
  20. package/src/cpp/{capturewindow.cpp → screenshot.cpp} +174 -2
  21. package/src/cpp/tesseract.cpp +49 -0
  22. package/src/dirnameLocal.mts +3 -0
  23. package/src/index.mts +454 -0
  24. package/src/keyCodes.mts +203 -0
  25. package/include/opencv2/core/affine.hpp +0 -678
  26. package/include/opencv2/core/async.hpp +0 -105
  27. package/include/opencv2/core/base.hpp +0 -664
  28. package/include/opencv2/core/bindings_utils.hpp +0 -325
  29. package/include/opencv2/core/bufferpool.hpp +0 -40
  30. package/include/opencv2/core/check.hpp +0 -170
  31. package/include/opencv2/core/core.hpp +0 -48
  32. package/include/opencv2/core/core_c.h +0 -3128
  33. package/include/opencv2/core/cuda/block.hpp +0 -211
  34. package/include/opencv2/core/cuda/border_interpolate.hpp +0 -722
  35. package/include/opencv2/core/cuda/color.hpp +0 -309
  36. package/include/opencv2/core/cuda/common.hpp +0 -131
  37. package/include/opencv2/core/cuda/datamov_utils.hpp +0 -113
  38. package/include/opencv2/core/cuda/detail/color_detail.hpp +0 -2018
  39. package/include/opencv2/core/cuda/detail/reduce.hpp +0 -365
  40. package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +0 -502
  41. package/include/opencv2/core/cuda/detail/transform_detail.hpp +0 -392
  42. package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +0 -191
  43. package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +0 -121
  44. package/include/opencv2/core/cuda/dynamic_smem.hpp +0 -88
  45. package/include/opencv2/core/cuda/emulation.hpp +0 -269
  46. package/include/opencv2/core/cuda/filters.hpp +0 -293
  47. package/include/opencv2/core/cuda/funcattrib.hpp +0 -79
  48. package/include/opencv2/core/cuda/functional.hpp +0 -805
  49. package/include/opencv2/core/cuda/limits.hpp +0 -128
  50. package/include/opencv2/core/cuda/reduce.hpp +0 -209
  51. package/include/opencv2/core/cuda/saturate_cast.hpp +0 -292
  52. package/include/opencv2/core/cuda/scan.hpp +0 -258
  53. package/include/opencv2/core/cuda/simd_functions.hpp +0 -869
  54. package/include/opencv2/core/cuda/transform.hpp +0 -75
  55. package/include/opencv2/core/cuda/type_traits.hpp +0 -90
  56. package/include/opencv2/core/cuda/utility.hpp +0 -230
  57. package/include/opencv2/core/cuda/vec_distance.hpp +0 -232
  58. package/include/opencv2/core/cuda/vec_math.hpp +0 -923
  59. package/include/opencv2/core/cuda/vec_traits.hpp +0 -288
  60. package/include/opencv2/core/cuda/warp.hpp +0 -139
  61. package/include/opencv2/core/cuda/warp_reduce.hpp +0 -76
  62. package/include/opencv2/core/cuda/warp_shuffle.hpp +0 -162
  63. package/include/opencv2/core/cuda.hpp +0 -1279
  64. package/include/opencv2/core/cuda.inl.hpp +0 -763
  65. package/include/opencv2/core/cuda_stream_accessor.hpp +0 -86
  66. package/include/opencv2/core/cuda_types.hpp +0 -144
  67. package/include/opencv2/core/cv_cpu_dispatch.h +0 -381
  68. package/include/opencv2/core/cv_cpu_helper.h +0 -550
  69. package/include/opencv2/core/cvdef.h +0 -973
  70. package/include/opencv2/core/cvstd.hpp +0 -190
  71. package/include/opencv2/core/cvstd.inl.hpp +0 -197
  72. package/include/opencv2/core/cvstd_wrapper.hpp +0 -154
  73. package/include/opencv2/core/detail/async_promise.hpp +0 -71
  74. package/include/opencv2/core/detail/dispatch_helper.impl.hpp +0 -49
  75. package/include/opencv2/core/detail/exception_ptr.hpp +0 -27
  76. package/include/opencv2/core/directx.hpp +0 -184
  77. package/include/opencv2/core/dualquaternion.hpp +0 -979
  78. package/include/opencv2/core/dualquaternion.inl.hpp +0 -487
  79. package/include/opencv2/core/eigen.hpp +0 -402
  80. package/include/opencv2/core/fast_math.hpp +0 -433
  81. package/include/opencv2/core/hal/hal.hpp +0 -256
  82. package/include/opencv2/core/hal/interface.h +0 -190
  83. package/include/opencv2/core/hal/intrin.hpp +0 -939
  84. package/include/opencv2/core/hal/intrin_avx.hpp +0 -3177
  85. package/include/opencv2/core/hal/intrin_avx512.hpp +0 -3090
  86. package/include/opencv2/core/hal/intrin_cpp.hpp +0 -3321
  87. package/include/opencv2/core/hal/intrin_forward.hpp +0 -191
  88. package/include/opencv2/core/hal/intrin_lasx.hpp +0 -3236
  89. package/include/opencv2/core/hal/intrin_msa.hpp +0 -1887
  90. package/include/opencv2/core/hal/intrin_neon.hpp +0 -2610
  91. package/include/opencv2/core/hal/intrin_rvv.hpp +0 -3320
  92. package/include/opencv2/core/hal/intrin_rvv071.hpp +0 -2545
  93. package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +0 -2080
  94. package/include/opencv2/core/hal/intrin_sse.hpp +0 -3467
  95. package/include/opencv2/core/hal/intrin_sse_em.hpp +0 -180
  96. package/include/opencv2/core/hal/intrin_vsx.hpp +0 -1608
  97. package/include/opencv2/core/hal/intrin_wasm.hpp +0 -2782
  98. package/include/opencv2/core/hal/msa_macros.h +0 -1558
  99. package/include/opencv2/core/hal/simd_utils.impl.hpp +0 -186
  100. package/include/opencv2/core/llapi/llapi.h +0 -102
  101. package/include/opencv2/core/mat.hpp +0 -3775
  102. package/include/opencv2/core/mat.inl.hpp +0 -3422
  103. package/include/opencv2/core/matx.hpp +0 -1536
  104. package/include/opencv2/core/neon_utils.hpp +0 -128
  105. package/include/opencv2/core/ocl.hpp +0 -917
  106. package/include/opencv2/core/ocl_genbase.hpp +0 -69
  107. package/include/opencv2/core/opencl/ocl_defs.hpp +0 -82
  108. package/include/opencv2/core/opencl/opencl_info.hpp +0 -212
  109. package/include/opencv2/core/opencl/opencl_svm.hpp +0 -81
  110. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +0 -602
  111. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +0 -146
  112. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +0 -371
  113. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +0 -272
  114. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +0 -62
  115. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +0 -42
  116. package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +0 -53
  117. package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +0 -53
  118. package/include/opencv2/core/opencl/runtime/opencl_core.hpp +0 -84
  119. package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +0 -47
  120. package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +0 -53
  121. package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +0 -47
  122. package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +0 -48
  123. package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +0 -42
  124. package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +0 -166
  125. package/include/opencv2/core/opengl.hpp +0 -733
  126. package/include/opencv2/core/openvx/ovx_defs.hpp +0 -48
  127. package/include/opencv2/core/operations.hpp +0 -610
  128. package/include/opencv2/core/optim.hpp +0 -302
  129. package/include/opencv2/core/ovx.hpp +0 -28
  130. package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +0 -72
  131. package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +0 -153
  132. package/include/opencv2/core/parallel/parallel_backend.hpp +0 -90
  133. package/include/opencv2/core/persistence.hpp +0 -1350
  134. package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +0 -30
  135. package/include/opencv2/core/private.cuda.hpp +0 -169
  136. package/include/opencv2/core/private.hpp +0 -896
  137. package/include/opencv2/core/quaternion.hpp +0 -1696
  138. package/include/opencv2/core/quaternion.inl.hpp +0 -1063
  139. package/include/opencv2/core/saturate.hpp +0 -180
  140. package/include/opencv2/core/simd_intrinsics.hpp +0 -87
  141. package/include/opencv2/core/softfloat.hpp +0 -514
  142. package/include/opencv2/core/sse_utils.hpp +0 -652
  143. package/include/opencv2/core/traits.hpp +0 -417
  144. package/include/opencv2/core/types.hpp +0 -2457
  145. package/include/opencv2/core/types_c.h +0 -2126
  146. package/include/opencv2/core/utility.hpp +0 -1229
  147. package/include/opencv2/core/utils/allocator_stats.hpp +0 -29
  148. package/include/opencv2/core/utils/allocator_stats.impl.hpp +0 -158
  149. package/include/opencv2/core/utils/buffer_area.private.hpp +0 -136
  150. package/include/opencv2/core/utils/configuration.private.hpp +0 -22
  151. package/include/opencv2/core/utils/filesystem.hpp +0 -82
  152. package/include/opencv2/core/utils/filesystem.private.hpp +0 -66
  153. package/include/opencv2/core/utils/fp_control.private.hpp +0 -29
  154. package/include/opencv2/core/utils/fp_control_utils.hpp +0 -69
  155. package/include/opencv2/core/utils/instrumentation.hpp +0 -125
  156. package/include/opencv2/core/utils/lock.private.hpp +0 -119
  157. package/include/opencv2/core/utils/logger.defines.hpp +0 -42
  158. package/include/opencv2/core/utils/logger.hpp +0 -218
  159. package/include/opencv2/core/utils/logtag.hpp +0 -28
  160. package/include/opencv2/core/utils/plugin_loader.private.hpp +0 -165
  161. package/include/opencv2/core/utils/tls.hpp +0 -235
  162. package/include/opencv2/core/utils/trace.hpp +0 -252
  163. package/include/opencv2/core/utils/trace.private.hpp +0 -421
  164. package/include/opencv2/core/va_intel.hpp +0 -75
  165. package/include/opencv2/core/version.hpp +0 -26
  166. package/include/opencv2/core/vsx_utils.hpp +0 -1047
  167. package/include/opencv2/core.hpp +0 -3365
  168. package/include/opencv2/imgcodecs/imgcodecs.hpp +0 -48
  169. package/include/opencv2/imgcodecs/imgcodecs_c.h +0 -1
  170. package/include/opencv2/imgcodecs/ios.h +0 -59
  171. package/include/opencv2/imgcodecs/legacy/constants_c.h +0 -54
  172. package/include/opencv2/imgcodecs/macosx.h +0 -20
  173. package/include/opencv2/imgcodecs.hpp +0 -407
  174. package/include/opencv2/imgproc/bindings.hpp +0 -34
  175. package/include/opencv2/imgproc/detail/gcgraph.hpp +0 -395
  176. package/include/opencv2/imgproc/hal/hal.hpp +0 -246
  177. package/include/opencv2/imgproc/hal/interface.h +0 -46
  178. package/include/opencv2/imgproc/imgproc.hpp +0 -48
  179. package/include/opencv2/imgproc/imgproc_c.h +0 -1177
  180. package/include/opencv2/imgproc/segmentation.hpp +0 -141
  181. package/include/opencv2/imgproc/types_c.h +0 -659
  182. package/include/opencv2/imgproc.hpp +0 -5035
  183. package/include/opencv2/opencv_modules.hpp +0 -17
  184. package/libs/libjpeg-turbo.lib +0 -0
  185. package/libs/libpng.lib +0 -0
  186. package/libs/opencv_core470.lib +0 -0
  187. package/libs/opencv_imgcodecs470.lib +0 -0
  188. package/libs/opencv_imgproc470.lib +0 -0
  189. package/libs/zlib.lib +0 -0
  190. /package/dist/{keyCodes.js → keyCodes.cjs} +0 -0
  191. /package/dist/{keyCodes.d.ts → keyCodes.d.cts} +0 -0
@@ -1,125 +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_INSTR_HPP
6
- #define OPENCV_UTILS_INSTR_HPP
7
-
8
- #include <opencv2/core/utility.hpp>
9
- #include <opencv2/core/utils/tls.hpp>
10
-
11
- namespace cv {
12
-
13
- //! @addtogroup core_utils
14
- //! @{
15
-
16
- #ifdef CV_COLLECT_IMPL_DATA
17
- CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
18
- CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
19
- // Get stored implementation flags and functions names arrays
20
- // Each implementation entry correspond to function name entry, so you can find which implementation was executed in which function
21
- CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
22
-
23
- CV_EXPORTS bool useCollection(); // return implementation collection state
24
- CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state
25
-
26
- #define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation
27
- #define CV_IMPL_OCL 0x02 // OpenCL implementation
28
- #define CV_IMPL_IPP 0x04 // IPP implementation
29
- #define CV_IMPL_MT 0x10 // multithreaded implementation
30
-
31
- #undef CV_IMPL_ADD
32
- #define CV_IMPL_ADD(impl) \
33
- if(cv::useCollection()) \
34
- { \
35
- cv::addImpl(impl, CV_Func); \
36
- }
37
- #endif
38
-
39
- // Instrumentation external interface
40
- namespace instr
41
- {
42
-
43
- #if !defined OPENCV_ABI_CHECK
44
-
45
- enum TYPE
46
- {
47
- TYPE_GENERAL = 0, // OpenCV API function, e.g. exported function
48
- TYPE_MARKER, // Information marker
49
- TYPE_WRAPPER, // Wrapper function for implementation
50
- TYPE_FUN, // Simple function call
51
- };
52
-
53
- enum IMPL
54
- {
55
- IMPL_PLAIN = 0,
56
- IMPL_IPP,
57
- IMPL_OPENCL,
58
- };
59
-
60
- struct NodeDataTls
61
- {
62
- NodeDataTls()
63
- {
64
- m_ticksTotal = 0;
65
- }
66
- uint64 m_ticksTotal;
67
- };
68
-
69
- class CV_EXPORTS NodeData
70
- {
71
- public:
72
- NodeData(const char* funName = 0, const char* fileName = NULL, int lineNum = 0, void* retAddress = NULL, bool alwaysExpand = false, cv::instr::TYPE instrType = TYPE_GENERAL, cv::instr::IMPL implType = IMPL_PLAIN);
73
- NodeData(NodeData &ref);
74
- ~NodeData();
75
- NodeData& operator=(const NodeData&);
76
-
77
- cv::String m_funName;
78
- cv::instr::TYPE m_instrType;
79
- cv::instr::IMPL m_implType;
80
- const char* m_fileName;
81
- int m_lineNum;
82
- void* m_retAddress;
83
- bool m_alwaysExpand;
84
- bool m_funError;
85
-
86
- volatile int m_counter;
87
- volatile uint64 m_ticksTotal;
88
- TLSDataAccumulator<NodeDataTls> m_tls;
89
- int m_threads;
90
-
91
- // No synchronization
92
- double getTotalMs() const { return ((double)m_ticksTotal / cv::getTickFrequency()) * 1000; }
93
- double getMeanMs() const { return (((double)m_ticksTotal/m_counter) / cv::getTickFrequency()) * 1000; }
94
- };
95
- bool operator==(const NodeData& lhs, const NodeData& rhs);
96
-
97
- typedef Node<NodeData> InstrNode;
98
-
99
- CV_EXPORTS InstrNode* getTrace();
100
-
101
- #endif // !defined OPENCV_ABI_CHECK
102
-
103
-
104
- CV_EXPORTS bool useInstrumentation();
105
- CV_EXPORTS void setUseInstrumentation(bool flag);
106
- CV_EXPORTS void resetTrace();
107
-
108
- enum FLAGS
109
- {
110
- FLAGS_NONE = 0,
111
- FLAGS_MAPPING = 0x01,
112
- FLAGS_EXPAND_SAME_NAMES = 0x02,
113
- };
114
-
115
- CV_EXPORTS void setFlags(FLAGS modeFlags);
116
- static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); }
117
- CV_EXPORTS FLAGS getFlags();
118
-
119
- } // namespace instr
120
-
121
- //! @}
122
-
123
- } // namespace
124
-
125
- #endif // OPENCV_UTILS_TLS_HPP
@@ -1,119 +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_LOCK_HPP
6
- #define OPENCV_UTILS_LOCK_HPP
7
-
8
- namespace cv { namespace utils {
9
-
10
-
11
- /** @brief A simple scoped lock (RAII-style locking for exclusive/write access).
12
- *
13
- * Emulate std::lock_guard (C++11), partially std::unique_lock (C++11),
14
- */
15
- template <class _Mutex>
16
- class lock_guard {
17
- public:
18
- typedef _Mutex Mutex;
19
-
20
- explicit inline lock_guard(Mutex &m) : mutex_(&m) { mutex_->lock(); }
21
-
22
- inline ~lock_guard() { if (mutex_) mutex_->unlock(); }
23
-
24
- inline void release()
25
- {
26
- CV_DbgAssert(mutex_);
27
- mutex_->unlock();
28
- mutex_ = NULL;
29
- }
30
-
31
- private:
32
- Mutex* mutex_;
33
-
34
- private:
35
- lock_guard(const lock_guard&); // disabled
36
- lock_guard& operator=(const lock_guard&); // disabled
37
- };
38
-
39
-
40
- /** @brief A shared scoped lock (RAII-style locking for shared/reader access).
41
- *
42
- * Emulate boost::shared_lock_guard, subset of std::shared_lock (C++14),
43
- */
44
- template <class _Mutex>
45
- class shared_lock_guard {
46
- public:
47
- typedef _Mutex Mutex;
48
-
49
- explicit inline shared_lock_guard(Mutex &m) : mutex_(&m) { mutex_->lock_shared(); }
50
-
51
- inline ~shared_lock_guard() { if (mutex_) mutex_->unlock_shared(); }
52
-
53
- inline void release()
54
- {
55
- CV_DbgAssert(mutex_);
56
- mutex_->unlock_shared();
57
- mutex_ = NULL;
58
- }
59
-
60
- protected:
61
- Mutex* mutex_;
62
-
63
- private:
64
- shared_lock_guard(const shared_lock_guard&); // disabled
65
- shared_lock_guard& operator=(const shared_lock_guard&); // disabled
66
- };
67
-
68
-
69
- /** @brief An optional simple scoped lock (RAII-style locking for exclusive/write access).
70
- *
71
- * Doesn't lock if mutex pointer is NULL.
72
- *
73
- * @sa lock_guard
74
- */
75
- template <class _Mutex>
76
- class optional_lock_guard {
77
- public:
78
- typedef _Mutex Mutex;
79
-
80
- explicit inline optional_lock_guard(Mutex* m) : mutex_(m) { if (mutex_) mutex_->lock(); }
81
-
82
- inline ~optional_lock_guard() { if (mutex_) mutex_->unlock(); }
83
-
84
- private:
85
- Mutex* mutex_;
86
-
87
- private:
88
- optional_lock_guard(const optional_lock_guard&); // disabled
89
- optional_lock_guard& operator=(const optional_lock_guard&); // disabled
90
- };
91
-
92
-
93
- /** @brief An optional shared scoped lock (RAII-style locking for shared/reader access).
94
- *
95
- * Doesn't lock if mutex pointer is NULL.
96
- *
97
- * @sa shared_lock_guard
98
- */
99
- template <class _Mutex>
100
- class optional_shared_lock_guard {
101
- public:
102
- typedef _Mutex Mutex;
103
-
104
- explicit inline optional_shared_lock_guard(Mutex* m) : mutex_(m) { if (mutex_) mutex_->lock_shared(); }
105
-
106
- inline ~optional_shared_lock_guard() { if (mutex_) mutex_->unlock_shared(); }
107
-
108
- protected:
109
- Mutex* mutex_;
110
-
111
- private:
112
- optional_shared_lock_guard(const optional_shared_lock_guard&); // disabled
113
- optional_shared_lock_guard& operator=(const optional_shared_lock_guard&); // disabled
114
- };
115
-
116
-
117
- }} // namespace
118
-
119
- #endif // OPENCV_UTILS_LOCK_HPP
@@ -1,42 +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_LOGGER_DEFINES_HPP
6
- #define OPENCV_LOGGER_DEFINES_HPP
7
-
8
- //! @addtogroup core_logging
9
- //! @{
10
-
11
- // Supported logging levels and their semantic
12
- #define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogLevel() call
13
- #define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error)
14
- #define CV_LOG_LEVEL_ERROR 2 //!< Error message
15
- #define CV_LOG_LEVEL_WARN 3 //!< Warning message
16
- #define CV_LOG_LEVEL_INFO 4 //!< Info message
17
- #define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build.
18
- #define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
19
-
20
- namespace cv {
21
- namespace utils {
22
- namespace logging {
23
-
24
- //! Supported logging levels and their semantic
25
- enum LogLevel {
26
- LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call
27
- LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error)
28
- LOG_LEVEL_ERROR = 2, //!< Error message
29
- LOG_LEVEL_WARNING = 3, //!< Warning message
30
- LOG_LEVEL_INFO = 4, //!< Info message
31
- LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build.
32
- LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
33
- #ifndef CV_DOXYGEN
34
- ENUM_LOG_LEVEL_FORCE_INT = INT_MAX
35
- #endif
36
- };
37
-
38
- }}} // namespace
39
-
40
- //! @}
41
-
42
- #endif // OPENCV_LOGGER_DEFINES_HPP
@@ -1,218 +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_LOGGER_HPP
6
- #define OPENCV_LOGGER_HPP
7
-
8
- #include <iostream>
9
- #include <sstream>
10
- #include <limits.h> // INT_MAX
11
-
12
- #include "logger.defines.hpp"
13
- #include "logtag.hpp"
14
-
15
- namespace cv {
16
- namespace utils {
17
- namespace logging {
18
-
19
- //! @addtogroup core_logging
20
- //! @{
21
-
22
- /** Set global logging level
23
- @return previous logging level
24
- */
25
- CV_EXPORTS LogLevel setLogLevel(LogLevel logLevel);
26
- /** Get global logging level */
27
- CV_EXPORTS LogLevel getLogLevel();
28
-
29
- CV_EXPORTS void registerLogTag(cv::utils::logging::LogTag* plogtag);
30
-
31
- CV_EXPORTS void setLogTagLevel(const char* tag, cv::utils::logging::LogLevel level);
32
-
33
- CV_EXPORTS cv::utils::logging::LogLevel getLogTagLevel(const char* tag);
34
-
35
- namespace internal {
36
-
37
- /** Get global log tag */
38
- CV_EXPORTS cv::utils::logging::LogTag* getGlobalLogTag();
39
-
40
- /** Write log message */
41
- CV_EXPORTS void writeLogMessage(LogLevel logLevel, const char* message);
42
-
43
- /** Write log message */
44
- CV_EXPORTS void writeLogMessageEx(LogLevel logLevel, const char* tag, const char* file, int line, const char* func, const char* message);
45
-
46
- } // namespace
47
-
48
- struct LogTagAuto
49
- : public LogTag
50
- {
51
- inline LogTagAuto(const char* _name, LogLevel _level)
52
- : LogTag(_name, _level)
53
- {
54
- registerLogTag(this);
55
- }
56
- };
57
-
58
- /**
59
- * \def CV_LOG_STRIP_LEVEL
60
- *
61
- * Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|SILENT] to compile out anything at that and before that logging level
62
- */
63
- #ifndef CV_LOG_STRIP_LEVEL
64
- # if defined NDEBUG
65
- # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG
66
- # else
67
- # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE
68
- # endif
69
- #endif
70
-
71
- #define CV_LOGTAG_PTR_CAST(expr) static_cast<const cv::utils::logging::LogTag*>(expr)
72
-
73
- // CV_LOGTAG_EXPAND_NAME is intended to be re-defined (undef and then define again)
74
- // to allows logging users to use a shorter name argument when calling
75
- // CV_LOG_WITH_TAG or its related macros such as CV_LOG_INFO.
76
- //
77
- // This macro is intended to modify the tag argument as a string (token), via
78
- // preprocessor token pasting or metaprogramming techniques. A typical usage
79
- // is to apply a prefix, such as
80
- // ...... #define CV_LOGTAG_EXPAND_NAME(tag) cv_logtag_##tag
81
- //
82
- // It is permitted to re-define to a hard-coded expression, ignoring the tag.
83
- // This would work identically like the CV_LOGTAG_FALLBACK macro.
84
- //
85
- // Important: When the logging macro is called with tag being NULL, a user-defined
86
- // CV_LOGTAG_EXPAND_NAME may expand it into cv_logtag_0, cv_logtag_NULL, or
87
- // cv_logtag_nullptr. Use with care. Also be mindful of C++ symbol redefinitions.
88
- //
89
- // If there is significant amount of logging code with tag being NULL, it is
90
- // recommended to use (re-define) CV_LOGTAG_FALLBACK to inject locally a default
91
- // tag at the beginning of a compilation unit, to minimize lines of code changes.
92
- //
93
- #define CV_LOGTAG_EXPAND_NAME(tag) tag
94
-
95
- // CV_LOGTAG_FALLBACK is intended to be re-defined (undef and then define again)
96
- // by any other compilation units to provide a log tag when the logging statement
97
- // does not specify one. The macro needs to expand into a C++ expression that can
98
- // be static_cast into (cv::utils::logging::LogTag*). Null (nullptr) is permitted.
99
- #define CV_LOGTAG_FALLBACK nullptr
100
-
101
- // CV_LOGTAG_GLOBAL is the tag used when a log tag is not specified in the logging
102
- // statement nor the compilation unit. The macro needs to expand into a C++
103
- // expression that can be static_cast into (cv::utils::logging::LogTag*). Must be
104
- // non-null. Do not re-define.
105
- #define CV_LOGTAG_GLOBAL cv::utils::logging::internal::getGlobalLogTag()
106
-
107
- #define CV_LOG_WITH_TAG(tag, msgLevel, extra_check0, extra_check1, ...) \
108
- for(;;) { \
109
- extra_check0; \
110
- const auto cv_temp_msglevel = (cv::utils::logging::LogLevel)(msgLevel); \
111
- if (cv_temp_msglevel >= (CV_LOG_STRIP_LEVEL)) break; \
112
- auto cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_EXPAND_NAME(tag)); \
113
- if (!cv_temp_logtagptr) cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_FALLBACK); \
114
- if (!cv_temp_logtagptr) cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_GLOBAL); \
115
- if (cv_temp_logtagptr && (cv_temp_msglevel > cv_temp_logtagptr->level)) break; \
116
- extra_check1; \
117
- std::stringstream cv_temp_logstream; \
118
- cv_temp_logstream << __VA_ARGS__; \
119
- cv::utils::logging::internal::writeLogMessageEx( \
120
- cv_temp_msglevel, \
121
- (cv_temp_logtagptr ? cv_temp_logtagptr->name : nullptr), \
122
- __FILE__, \
123
- __LINE__, \
124
- CV_Func, \
125
- cv_temp_logstream.str().c_str()); \
126
- break; \
127
- }
128
-
129
- #define CV_LOG_FATAL(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, , , __VA_ARGS__)
130
- #define CV_LOG_ERROR(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, , , __VA_ARGS__)
131
- #define CV_LOG_WARNING(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, , , __VA_ARGS__)
132
- #define CV_LOG_INFO(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, , , __VA_ARGS__)
133
- #define CV_LOG_DEBUG(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, , , __VA_ARGS__)
134
- #define CV_LOG_VERBOSE(tag, v, ...) CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), , , __VA_ARGS__)
135
-
136
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO
137
- #undef CV_LOG_INFO
138
- #define CV_LOG_INFO(tag, ...)
139
- #endif
140
-
141
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG
142
- #undef CV_LOG_DEBUG
143
- #define CV_LOG_DEBUG(tag, ...)
144
- #endif
145
-
146
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE
147
- #undef CV_LOG_VERBOSE
148
- #define CV_LOG_VERBOSE(tag, v, ...)
149
- #endif
150
-
151
- //! @cond IGNORED
152
- #define CV__LOG_ONCE_CHECK_PRE \
153
- static bool _cv_log_once_ ## __LINE__ = false; \
154
- if (_cv_log_once_ ## __LINE__) break;
155
-
156
- #define CV__LOG_ONCE_CHECK_POST \
157
- _cv_log_once_ ## __LINE__ = true;
158
-
159
- #define CV__LOG_IF_CHECK(logging_cond) \
160
- if (!(logging_cond)) break;
161
-
162
- //! @endcond
163
-
164
-
165
- // CV_LOG_ONCE_XXX macros
166
-
167
- #define CV_LOG_ONCE_ERROR(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)
168
- #define CV_LOG_ONCE_WARNING(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)
169
- #define CV_LOG_ONCE_INFO(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)
170
- #define CV_LOG_ONCE_DEBUG(tag, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)
171
- #define CV_LOG_ONCE_VERBOSE(tag, v, ...) CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)
172
-
173
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO
174
- #undef CV_LOG_ONCE_INFO
175
- #define CV_LOG_ONCE_INFO(tag, ...)
176
- #endif
177
-
178
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG
179
- #undef CV_LOG_ONCE_DEBUG
180
- #define CV_LOG_ONCE_DEBUG(tag, ...)
181
- #endif
182
-
183
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE
184
- #undef CV_LOG_ONCE_VERBOSE
185
- #define CV_LOG_ONCE_VERBOSE(tag, v, ...)
186
- #endif
187
-
188
-
189
- // CV_LOG_IF_XXX macros
190
-
191
- #define CV_LOG_IF_FATAL(tag, logging_cond, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
192
- #define CV_LOG_IF_ERROR(tag, logging_cond, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
193
- #define CV_LOG_IF_WARNING(tag, logging_cond, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
194
- #define CV_LOG_IF_INFO(tag, logging_cond, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
195
- #define CV_LOG_IF_DEBUG(tag, logging_cond, ...) CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
196
- #define CV_LOG_IF_VERBOSE(tag, v, logging_cond, ...) CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
197
-
198
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO
199
- #undef CV_LOG_IF_INFO
200
- #define CV_LOG_IF_INFO(tag, logging_cond, ...)
201
- #endif
202
-
203
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG
204
- #undef CV_LOG_IF_DEBUG
205
- #define CV_LOG_IF_DEBUG(tag, logging_cond, ...)
206
- #endif
207
-
208
- #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE
209
- #undef CV_LOG_IF_VERBOSE
210
- #define CV_LOG_IF_VERBOSE(tag, v, logging_cond, ...)
211
- #endif
212
-
213
-
214
- //! @}
215
-
216
- }}} // namespace
217
-
218
- #endif // OPENCV_LOGGER_HPP
@@ -1,28 +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_CORE_LOGTAG_HPP
6
- #define OPENCV_CORE_LOGTAG_HPP
7
-
8
- #include "opencv2/core/cvstd.hpp"
9
- #include "logger.defines.hpp"
10
-
11
- namespace cv {
12
- namespace utils {
13
- namespace logging {
14
-
15
- struct LogTag
16
- {
17
- const char* name;
18
- LogLevel level;
19
-
20
- inline LogTag(const char* _name, LogLevel _level)
21
- : name(_name)
22
- , level(_level)
23
- {}
24
- };
25
-
26
- }}}
27
-
28
- #endif
@@ -1,165 +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_PLUGIN_LOADER_HPP
6
- #define OPENCV_UTILS_PLUGIN_LOADER_HPP
7
-
8
- #include "opencv2/core/utils/filesystem.hpp"
9
- #include "opencv2/core/utils/filesystem.private.hpp"
10
-
11
- #if OPENCV_HAVE_FILESYSTEM_SUPPORT
12
-
13
- #if defined(_WIN32)
14
- #include <windows.h>
15
- #elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__) || defined(__GLIBC__)
16
- #include <dlfcn.h>
17
- #endif
18
-
19
- namespace cv { namespace plugin { namespace impl {
20
-
21
- #if defined(_WIN32)
22
- typedef HMODULE LibHandle_t;
23
- typedef wchar_t FileSystemChar_t;
24
- typedef std::wstring FileSystemPath_t;
25
-
26
- // TODO wchar_t <=> UTF-8
27
- static inline
28
- FileSystemPath_t toFileSystemPath(const std::string& p)
29
- {
30
- FileSystemPath_t result;
31
- result.resize(p.size());
32
- for (size_t i = 0; i < p.size(); i++)
33
- result[i] = (wchar_t)p[i];
34
- return result;
35
- }
36
-
37
- // TODO wchar_t <=> UTF-8
38
- static inline
39
- std::string toPrintablePath(const FileSystemPath_t& p)
40
- {
41
- std::string result;
42
- result.resize(p.size());
43
- for (size_t i = 0; i < p.size(); i++)
44
- {
45
- wchar_t ch = p[i];
46
- if ((int)ch >= ' ' && (int)ch < 128)
47
- result[i] = (char)ch;
48
- else
49
- result[i] = '?';
50
- }
51
- return result;
52
- }
53
- #else // !_WIN32
54
- typedef void* LibHandle_t;
55
- typedef char FileSystemChar_t;
56
- typedef std::string FileSystemPath_t;
57
-
58
- static inline FileSystemPath_t toFileSystemPath(const std::string& p) { return p; }
59
- static inline std::string toPrintablePath(const FileSystemPath_t& p) { return p; }
60
- #endif
61
-
62
-
63
- static inline
64
- void* getSymbol_(LibHandle_t h, const char* symbolName)
65
- {
66
- #if defined(_WIN32)
67
- return (void*)GetProcAddress(h, symbolName);
68
- #elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__) || defined(__GLIBC__)
69
- return dlsym(h, symbolName);
70
- #endif
71
- }
72
-
73
- static inline
74
- LibHandle_t libraryLoad_(const FileSystemPath_t& filename)
75
- {
76
- #if defined(_WIN32)
77
- # ifdef WINRT
78
- return LoadPackagedLibrary(filename.c_str(), 0);
79
- # else
80
- return LoadLibraryW(filename.c_str());
81
- #endif
82
- #elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__) || defined(__GLIBC__)
83
- void* handle = dlopen(filename.c_str(), RTLD_NOW);
84
- CV_LOG_IF_DEBUG(NULL, !handle, "dlopen() error: " << dlerror());
85
- return handle;
86
- #endif
87
- }
88
-
89
- static inline
90
- void libraryRelease_(LibHandle_t h)
91
- {
92
- #if defined(_WIN32)
93
- FreeLibrary(h);
94
- #elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__) || defined(__GLIBC__)
95
- dlclose(h);
96
- #endif
97
- }
98
-
99
- static inline
100
- std::string libraryPrefix()
101
- {
102
- #if defined(_WIN32)
103
- return "";
104
- #else
105
- return "lib";
106
- #endif
107
- }
108
- static inline
109
- std::string librarySuffix()
110
- {
111
- #if defined(_WIN32)
112
- const char* suffix = ""
113
- CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)
114
- #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)
115
- "_64"
116
- #endif
117
- #if defined(_DEBUG) && defined(DEBUG_POSTFIX)
118
- CVAUX_STR(DEBUG_POSTFIX)
119
- #endif
120
- ".dll";
121
- return suffix;
122
- #else
123
- return ".so";
124
- #endif
125
- }
126
-
127
-
128
- //============================
129
-
130
- class CV_EXPORTS DynamicLib
131
- {
132
- private:
133
- LibHandle_t handle;
134
- const FileSystemPath_t fname;
135
- bool disableAutoUnloading_;
136
-
137
- public:
138
- DynamicLib(const FileSystemPath_t& filename);
139
- ~DynamicLib();
140
- /** Do not automatically unload library in destructor */
141
- inline void disableAutomaticLibraryUnloading()
142
- {
143
- disableAutoUnloading_ = true;
144
- }
145
- inline bool isLoaded() const
146
- {
147
- return handle != NULL;
148
- }
149
- void* getSymbol(const char* symbolName) const;
150
- std::string getName() const;
151
- private:
152
- void libraryLoad(const FileSystemPath_t& filename);
153
- void libraryRelease();
154
-
155
- private:
156
- DynamicLib(const DynamicLib &) = delete;
157
- DynamicLib &operator=(const DynamicLib &) = delete;
158
- };
159
-
160
-
161
- }}} // namespace
162
-
163
- #endif // OPENCV_HAVE_FILESYSTEM_SUPPORT
164
-
165
- #endif // OPENCV_UTILS_PLUGIN_LOADER_HPP