dnn: update "guard" inline namespace
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Mon, 3 Sep 2018 20:20:02 +0000 (20:20 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Mon, 3 Sep 2018 20:46:57 +0000 (20:46 +0000)
- differ from 3.4 branch

20 files changed:
modules/dnn/include/opencv2/dnn/all_layers.hpp
modules/dnn/include/opencv2/dnn/dict.hpp
modules/dnn/include/opencv2/dnn/dnn.hpp
modules/dnn/include/opencv2/dnn/dnn.inl.hpp
modules/dnn/include/opencv2/dnn/layer.details.hpp
modules/dnn/include/opencv2/dnn/layer.hpp
modules/dnn/include/opencv2/dnn/shape_utils.hpp
modules/dnn/include/opencv2/dnn/version.hpp [new file with mode: 0644]
modules/dnn/src/caffe/caffe_importer.cpp
modules/dnn/src/caffe/caffe_shrinker.cpp
modules/dnn/src/darknet/darknet_importer.cpp
modules/dnn/src/dnn.cpp
modules/dnn/src/init.cpp
modules/dnn/src/nms.cpp
modules/dnn/src/precomp.hpp
modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
modules/dnn/src/tensorflow/tf_graph_simplifier.hpp
modules/dnn/src/tensorflow/tf_importer.cpp
modules/dnn/src/torch/torch_importer.cpp
modules/dnn/test/test_precomp.hpp

index b541614..cd4cca4 100644 (file)
@@ -45,7 +45,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 //! @addtogroup dnn
 //! @{
 
@@ -617,7 +617,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
 
 //! @}
 //! @}
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 #endif
index 69287dc..64ef2f7 100644 (file)
@@ -50,7 +50,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 //! @addtogroup dnn
 //! @{
 
@@ -149,7 +149,7 @@ public:
 };
 
 //! @}
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 
index e99f844..a50c50c 100644 (file)
 #include <vector>
 #include <opencv2/core.hpp>
 
-#if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_EXPERIMENTAL_NS
-#define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v7 {
-#define CV__DNN_EXPERIMENTAL_NS_END }
-namespace cv { namespace dnn { namespace experimental_dnn_34_v7 { } using namespace experimental_dnn_34_v7; }}
-#else
-#define CV__DNN_EXPERIMENTAL_NS_BEGIN
-#define CV__DNN_EXPERIMENTAL_NS_END
-#endif
+#include "../dnn/version.hpp"
 
 #include <opencv2/dnn/dict.hpp>
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 //! @addtogroup dnn
 //! @{
 
@@ -906,7 +899,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
                              const float eta = 1.f, const int top_k = 0);
 
 //! @}
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 
index d2317fc..4be49bc 100644 (file)
@@ -46,7 +46,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 template<typename TypeIter>
 DictValue DictValue::arrayInt(TypeIter begin, int size)
@@ -379,7 +379,7 @@ inline std::map<String, DictValue>::const_iterator Dict::end() const
     return dict.end();
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 
index 619514e..1133da5 100644 (file)
@@ -9,7 +9,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 /** @brief Registers layer constructor in runtime.
 *   @param type string, containing type name of the layer.
@@ -72,7 +72,7 @@ public:
 };
 
 } // namespace
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
 
 #endif
index c4712b8..8500599 100644 (file)
@@ -45,7 +45,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 //! @addtogroup dnn
 //! @{
 //!
@@ -79,7 +79,7 @@ private:
 
 //! @}
 //! @}
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 #endif
index b0ed3af..98adcc3 100644 (file)
@@ -50,7 +50,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 //Slicing
 
@@ -213,7 +213,7 @@ inline Range clamp(const Range& r, int axisSize)
     return clamped;
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }
 }
 #endif
diff --git a/modules/dnn/include/opencv2/dnn/version.hpp b/modules/dnn/include/opencv2/dnn/version.hpp
new file mode 100644 (file)
index 0000000..6d1568c
--- /dev/null
@@ -0,0 +1,21 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#ifndef OPENCV_DNN_VERSION_HPP
+#define OPENCV_DNN_VERSION_HPP
+
+/// Use with major OpenCV version only.
+#define OPENCV_DNN_API_VERSION 20180903
+
+#if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_INLINE_NS
+#define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION)
+#define CV__DNN_INLINE_NS_BEGIN namespace CV__DNN_INLINE_NS {
+#define CV__DNN_INLINE_NS_END }
+namespace cv { namespace dnn { namespace CV__DNN_INLINE_NS { } using namespace CV__DNN_INLINE_NS; }}
+#else
+#define CV__DNN_INLINE_NS_BEGIN
+#define CV__DNN_INLINE_NS_END
+#endif
+
+#endif  // OPENCV_DNN_VERSION_HPP
index 24e918d..c09b5b2 100644 (file)
@@ -54,7 +54,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 #ifdef HAVE_PROTOBUF
 using ::google::protobuf::RepeatedField;
@@ -464,5 +464,5 @@ Net readNetFromCaffe(const std::vector<uchar>& bufferProto, const std::vector<uc
 
 #endif //HAVE_PROTOBUF
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 9dc6f9f..99e0ef8 100644 (file)
@@ -13,7 +13,7 @@
 #endif
 
 namespace cv { namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 #ifdef HAVE_PROTOBUF
 
@@ -76,5 +76,5 @@ void shrinkCaffeModel(const String& src, const String& dst, const std::vector<St
 
 #endif  // HAVE_PROTOBUF
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 282b372..f1269bd 100644 (file)
@@ -54,7 +54,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 namespace
 {
@@ -251,5 +251,5 @@ Net readNetFromDarknet(const std::vector<uchar>& bufferCfg, const std::vector<uc
                               bufferModelPtr, bufferModel.size());
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 1301c28..5248d74 100644 (file)
@@ -57,7 +57,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 // this option is useful to run valgrind memory errors detection
 static bool DNN_DISABLE_MEMORY_OPTIMIZATIONS = utils::getConfigurationParameterBool("OPENCV_DNN_DISABLE_MEMORY_OPTIMIZATIONS", false);
@@ -3465,5 +3465,5 @@ Net readNetFromModelOptimizer(const String &xml, const String &bin)
     return Net::readFromModelOptimizer(xml, bin);
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 8db0828..c78ec35 100644 (file)
@@ -46,7 +46,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 static Mutex* __initialization_mutex = NULL;
 Mutex& getInitializationMutex()
@@ -132,5 +132,5 @@ void initializeLayerFactory()
     CV_DNN_REGISTER_LAYER_CLASS(LSTM,           LSTMLayer);
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 051a9cb..d8d2189 100644 (file)
 
 #include <opencv2/imgproc.hpp>
 
-namespace cv
-{
-namespace dnn
-{
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+namespace cv { namespace dnn {
+CV__DNN_INLINE_NS_BEGIN
 
 static inline float rectOverlap(const Rect& a, const Rect& b)
 {
@@ -51,6 +48,6 @@ void NMSBoxes(const std::vector<RotatedRect>& bboxes, const std::vector<float>&
     NMSFast_(bboxes, scores, score_threshold, nms_threshold, eta, top_k, indices, rotatedRectIOU);
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }// dnn
 }// cv
index f6230c4..6266e1e 100644 (file)
@@ -63,9 +63,9 @@
 
 
 namespace cv { namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 #define IS_DNN_OPENCL_TARGET(id) (id == DNN_TARGET_OPENCL || id == DNN_TARGET_OPENCL_FP16)
 Mutex& getInitializationMutex();
 void initializeLayerFactory();
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index a766d2a..51a249e 100644 (file)
@@ -12,7 +12,7 @@
 #include "tf_graph_simplifier.hpp"
 
 namespace cv { namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 using ::google::protobuf::RepeatedField;
 using ::google::protobuf::MapPair;
@@ -782,7 +782,7 @@ void releaseTensor(tensorflow::TensorProto* tensor)
     }
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }}  // namespace dnn, namespace cv
 
 #endif  // HAVE_PROTOBUF
index d60ced7..8b76052 100644 (file)
@@ -15,7 +15,7 @@
 #include "tf_io.hpp"
 
 namespace cv { namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 void RemoveIdentityOps(tensorflow::GraphDef& net);
 
@@ -25,7 +25,7 @@ Mat getTensorContent(const tensorflow::TensorProto &tensor);
 
 void releaseTensor(tensorflow::TensorProto* tensor);
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }}  // namespace dnn, namespace cv
 
 #endif  // HAVE_PROTOBUF
index 264d3cb..86596c1 100644 (file)
@@ -24,7 +24,7 @@ Implementation of Tensorflow models parser
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 #if HAVE_PROTOBUF
 
@@ -1950,5 +1950,5 @@ Net readNetFromTensorflow(const std::vector<uchar>& bufferModel, const std::vect
                                  bufferConfigPtr, bufferConfig.size());
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index 2338c73..4f0041e 100644 (file)
@@ -51,7 +51,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 using namespace TH;
 
@@ -1240,5 +1240,5 @@ Net readNetFromTorch(const String &model, bool isBinary)
     return net;
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
index a0a46ab..d74e0bf 100644 (file)
@@ -51,7 +51,7 @@
 
 namespace cv {
 namespace dnn {
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
 
 static inline void PrintTo(const cv::dnn::Backend& v, std::ostream* os)
 {
@@ -75,7 +75,7 @@ static inline void PrintTo(const cv::dnn::Target& v, std::ostream* os)
     *os << "DNN_TARGET_UNKNOWN(" << v << ")";
 }
 
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
 }} // namespace
 
 namespace opencv_test {