Boring changes - core.

This and several following commits contain the "boring" changes required
to support the new Ptr. These are changes like:

* new T -> makePtr<T> or .reset(new T) or Ptr<T>(new T)
  (depending on the situation)
* p.empty() -> !p
* delete_obj -> DefaultDeleter::operator()

and similar changes that are numerous, but primitive.
This commit is contained in:
Roman Donchenko
2013-08-13 16:22:07 +04:00
parent 461c98fa86
commit 8200a95ced
14 changed files with 58 additions and 87 deletions

View File

@@ -1882,13 +1882,13 @@ CV_EXPORTS void insertImageCOI(InputArray coiimg, CvArr* arr, int coi=-1);
//////// specializied implementations of Ptr::delete_obj() for classic OpenCV types ////////
////// specialized implementations of DefaultDeleter::operator() for classic OpenCV types //////
template<> CV_EXPORTS void Ptr<CvMat>::delete_obj();
template<> CV_EXPORTS void Ptr<IplImage>::delete_obj();
template<> CV_EXPORTS void Ptr<CvMatND>::delete_obj();
template<> CV_EXPORTS void Ptr<CvSparseMat>::delete_obj();
template<> CV_EXPORTS void Ptr<CvMemStorage>::delete_obj();
template<> CV_EXPORTS void DefaultDeleter<CvMat>::operator ()(CvMat* obj) const;
template<> CV_EXPORTS void DefaultDeleter<IplImage>::operator ()(IplImage* obj) const;
template<> CV_EXPORTS void DefaultDeleter<CvMatND>::operator ()(CvMatND* obj) const;
template<> CV_EXPORTS void DefaultDeleter<CvSparseMat>::operator ()(CvSparseMat* obj) const;
template<> CV_EXPORTS void DefaultDeleter<CvMemStorage>::operator ()(CvMemStorage* obj) const;
////////////// convenient wrappers for operating old-style dynamic structures //////////////

View File

@@ -666,12 +666,6 @@ CV_EXPORTS void printShortCudaDeviceInfo(int device);
}} // namespace cv { namespace gpu {
namespace cv {
template <> CV_EXPORTS void Ptr<cv::gpu::Stream::Impl>::delete_obj();
template <> CV_EXPORTS void Ptr<cv::gpu::Event::Impl>::delete_obj();
}
#include "opencv2/core/gpu.inl.hpp"

View File

@@ -283,12 +283,6 @@ CV_EXPORTS void setGlDevice(int device = 0);
}}
namespace cv {
template <> CV_EXPORTS void Ptr<cv::ogl::Buffer::Impl>::delete_obj();
template <> CV_EXPORTS void Ptr<cv::ogl::Texture2D::Impl>::delete_obj();
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

View File

@@ -452,7 +452,7 @@ template<typename _Tp> inline
void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (algo_ptr.empty()) {
if (!algo_ptr) {
CV_Error( Error::StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
@@ -468,7 +468,7 @@ template<typename _Tp> inline
void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (algo_ptr.empty()) {
if (!algo_ptr) {
CV_Error( Error::StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);

View File

@@ -209,9 +209,9 @@ public:
CV_WRAP FileNode operator[](const char* nodename) const;
//! returns pointer to the underlying C FileStorage structure
CvFileStorage* operator *() { return fs; }
CvFileStorage* operator *() { return fs.get(); }
//! returns pointer to the underlying C FileStorage structure
const CvFileStorage* operator *() const { return fs; }
const CvFileStorage* operator *() const { return fs.get(); }
//! writes one or more numbers of the specified format to the currently written structure
void writeRaw( const String& fmt, const uchar* vec, size_t len );
//! writes the registered C structure (CvMat, CvMatND, CvSeq). See cvWrite()
@@ -226,7 +226,7 @@ public:
int state; //!< the writer state
};
template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
template<> CV_EXPORTS void DefaultDeleter<CvFileStorage>::operator ()(CvFileStorage* obj) const;
/*!
File Storage Node class