mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
add documents of CvError
This commit is contained in:
parent
e7021b126c
commit
6f7a251112
3 changed files with 24 additions and 68 deletions
|
@ -11,51 +11,7 @@
|
||||||
/*
|
/*
|
||||||
* Document-class: OpenCV::CvError
|
* Document-class: OpenCV::CvError
|
||||||
*
|
*
|
||||||
* =Internal OpenCV errors
|
* OpenCV errors
|
||||||
*
|
|
||||||
* This module collect OpenCV internal error wrapper classes.
|
|
||||||
* * CvStatusBackTrace
|
|
||||||
* * CvStatusError
|
|
||||||
* * CvStatusInternal
|
|
||||||
* * CvStatusNoMemory
|
|
||||||
* * CvStatusBadArgument
|
|
||||||
* * CvStatusNoConverge
|
|
||||||
* * CvStatusAutoTrace
|
|
||||||
*
|
|
||||||
* * CvHeaderIsNull
|
|
||||||
* * CvBadImageSize
|
|
||||||
* * CvBadOffset
|
|
||||||
* * CvBadDataPointer
|
|
||||||
* * CvBadStep
|
|
||||||
* * CvBadModelOrChannelSequence
|
|
||||||
* * CvBadNumChannels
|
|
||||||
* * CvBadAlphaChannel
|
|
||||||
* * CvBadOrder
|
|
||||||
* * CvBadOrigin
|
|
||||||
* * CvBadAlign
|
|
||||||
* * CvBadCallback
|
|
||||||
* * CvBadTileSize
|
|
||||||
* * CvBadCOI
|
|
||||||
* * CvBadROISize
|
|
||||||
*
|
|
||||||
* * CvMaskIsTiled
|
|
||||||
*
|
|
||||||
* * CvStatusNullPointer
|
|
||||||
* * CvStatusVectorLengthError
|
|
||||||
* * CvStatusFilterStructContentError
|
|
||||||
* * CvStatusKernelStructContentError
|
|
||||||
* * CvStatusFilterOffsetError
|
|
||||||
*
|
|
||||||
* * CvStatusBadSize
|
|
||||||
* * CvStatusDivByZero
|
|
||||||
* * CvStatusInplaceNotSupported
|
|
||||||
* * CvStatusObjectNotFound
|
|
||||||
* * CvStatusUnmatchedFormant
|
|
||||||
* * CvStatusUnsupportedFormats
|
|
||||||
* * CvStatusOutOfRange
|
|
||||||
* * CvStatusParseError
|
|
||||||
* * CvStatusNotImplemented
|
|
||||||
* * CvStsBadMemoryBlock
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__NAMESPACE_BEGIN_OPENCV
|
__NAMESPACE_BEGIN_OPENCV
|
||||||
|
@ -78,18 +34,32 @@ rb_class()
|
||||||
return rb_klass;
|
return rb_klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
void define_ruby_class()
|
VALUE
|
||||||
|
by_code(int error_code)
|
||||||
{
|
{
|
||||||
|
VALUE klass = 0;
|
||||||
|
st_lookup(cv_error, (st_data_t)error_code, (st_data_t*)&klass);
|
||||||
|
return klass ? klass : rb_eStandardError;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
raise(cv::Exception e)
|
||||||
|
{
|
||||||
|
rb_raise(by_code(e.code), "%s", e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
init_ruby_class()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
// For documentation using YARD
|
||||||
|
VALUE opencv = rb_define_module("OpenCV");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (rb_klass)
|
if (rb_klass)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* opencv = rb_define_module("OpenCV");
|
|
||||||
*
|
|
||||||
* note: this comment is used by rdoc.
|
|
||||||
*/
|
|
||||||
VALUE opencv = rb_module_opencv();
|
VALUE opencv = rb_module_opencv();
|
||||||
|
|
||||||
rb_klass = rb_define_class_under(opencv, "CvError", rb_eStandardError);
|
rb_klass = rb_define_class_under(opencv, "CvError", rb_eStandardError);
|
||||||
REGISTER_CVERROR("CvStsBackTrace", CV_StsBackTrace);
|
REGISTER_CVERROR("CvStsBackTrace", CV_StsBackTrace);
|
||||||
REGISTER_CVERROR("CvStsError", CV_StsError);
|
REGISTER_CVERROR("CvStsError", CV_StsError);
|
||||||
|
@ -140,20 +110,6 @@ void define_ruby_class()
|
||||||
REGISTER_CVERROR("CvGpuNotSupported", CV_GpuNotSupported);
|
REGISTER_CVERROR("CvGpuNotSupported", CV_GpuNotSupported);
|
||||||
REGISTER_CVERROR("CvGpuApiCallError", CV_GpuApiCallError);
|
REGISTER_CVERROR("CvGpuApiCallError", CV_GpuApiCallError);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
|
||||||
by_code(int error_code)
|
|
||||||
{
|
|
||||||
VALUE klass = 0;
|
|
||||||
st_lookup(cv_error, (st_data_t)error_code, (st_data_t*)&klass);
|
|
||||||
return klass ? klass : rb_eStandardError;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
raise(cv::Exception e)
|
|
||||||
{
|
|
||||||
rb_raise(by_code(e.code), "%s", e.what());
|
|
||||||
}
|
|
||||||
|
|
||||||
__NAMESPACE_END_CVERROR
|
__NAMESPACE_END_CVERROR
|
||||||
__NAMESPACE_END_OPENCV
|
__NAMESPACE_END_OPENCV
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
__NAMESPACE_BEGIN_OPENCV
|
__NAMESPACE_BEGIN_OPENCV
|
||||||
__NAMESPACE_BEGIN_CVERROR
|
__NAMESPACE_BEGIN_CVERROR
|
||||||
|
|
||||||
void define_ruby_class();
|
void init_ruby_class();
|
||||||
VALUE by_code(int error_code);
|
VALUE by_code(int error_code);
|
||||||
void raise(cv::Exception e);
|
void raise(cv::Exception e);
|
||||||
|
|
||||||
|
|
|
@ -665,7 +665,7 @@ extern "C" {
|
||||||
|
|
||||||
mOpenCV::define_ruby_module();
|
mOpenCV::define_ruby_module();
|
||||||
|
|
||||||
mOpenCV::cCvError::define_ruby_class();
|
mOpenCV::cCvError::init_ruby_class();
|
||||||
mOpenCV::cCvPoint::define_ruby_class();
|
mOpenCV::cCvPoint::define_ruby_class();
|
||||||
mOpenCV::cCvPoint2D32f::define_ruby_class();
|
mOpenCV::cCvPoint2D32f::define_ruby_class();
|
||||||
mOpenCV::cCvPoint3D32f::define_ruby_class();
|
mOpenCV::cCvPoint3D32f::define_ruby_class();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue