Added Ptr<T> support to AlgorithmInfo; fixed some warnings

This commit is contained in:
Andrey Kamaev 2012-06-29 07:46:53 +00:00
parent a25c27ca05
commit 4d09d62f85
5 changed files with 43 additions and 15 deletions

View File

@ -4409,6 +4409,16 @@ public:
Ptr<Algorithm> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<Algorithm>&)=0,
const string& help=string());
template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const string& help=string());
template<typename _Tp> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const string& help=string());
protected:
AlgorithmInfoData* data;
void set(Algorithm* algo, const char* name, int argType,

View File

@ -3843,7 +3843,7 @@ template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const string& name)
}
template<typename _Tp>
void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (algo_ptr.empty()) {
@ -3851,12 +3851,12 @@ void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
}
template<typename _Tp>
void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
inline void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
{
this->set<_Tp>(_name.c_str(), value);
}
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const
{
@ -3872,6 +3872,24 @@ template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::ge
return value;
}
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
}
#endif // __cplusplus

View File

@ -144,7 +144,7 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
obj.info()->addParam(obj, "detector", obj.detector);
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
obj.info()->addParam(obj, "gridRows", obj.gridRows);
obj.info()->addParam(obj, "gridCols", obj.gridCols));

View File

@ -521,7 +521,7 @@ void icvSetOpenGlCleanCallback(const char*, CvOpenGlCleanCallback, void*)
#if defined (HAVE_QT)
CvFont cv::fontQt(const string& nameFont, int pointSize, Scalar color, int weight, int style, int spacing)
CvFont cv::fontQt(const string& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/)
{
return cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
}

View File

@ -2414,13 +2414,13 @@ void DefaultViewPort::startDisplayInfo(QString text, int delayms)
}
void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback callback, void* userdata)
void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback /*callback*/, void* /*userdata*/)
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
}
void DefaultViewPort::setOpenGlCleanCallback(CvOpenGlCleanCallback callback, void* userdata)
void DefaultViewPort::setOpenGlCleanCallback(CvOpenGlCleanCallback /*callback*/, void* /*userdata*/)
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
}
@ -3058,7 +3058,7 @@ void DefaultViewPort::drawInstructions(QPainter *painter)
}
void DefaultViewPort::setSize(QSize size_)
void DefaultViewPort::setSize(QSize /*size_*/)
{
}
@ -3101,11 +3101,11 @@ void OpenGlViewPort::setMouseCallBack(CvMouseCallback callback, void* param)
mouseData = param;
}
void OpenGlViewPort::writeSettings(QSettings& settings)
void OpenGlViewPort::writeSettings(QSettings& /*settings*/)
{
}
void OpenGlViewPort::readSettings(QSettings& settings)
void OpenGlViewPort::readSettings(QSettings& /*settings*/)
{
}
@ -3114,15 +3114,15 @@ double OpenGlViewPort::getRatio()
return (double)width() / height();
}
void OpenGlViewPort::setRatio(int flags)
void OpenGlViewPort::setRatio(int /*flags*/)
{
}
void OpenGlViewPort::updateImage(const CvArr* arr)
void OpenGlViewPort::updateImage(const CvArr* /*arr*/)
{
}
void OpenGlViewPort::startDisplayInfo(QString text, int delayms)
void OpenGlViewPort::startDisplayInfo(QString /*text*/, int /*delayms*/)
{
}
@ -3350,9 +3350,9 @@ void GlFuncTab_QT::unmapBuffer(unsigned int target) const
__END__;
}
void GlFuncTab_QT::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const
void GlFuncTab_QT::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool /*underline*/, int start, int count, int base) const
{
CV_FUNCNAME( "GlFuncTab_QT::generateBitmapFont" );
//CV_FUNCNAME( "GlFuncTab_QT::generateBitmapFont" );
QFont font(QString(family.c_str()), height, weight, italic);