MCPcopy Create free account
hub / github.com/creatale/node-dv / get

Method get

deps/opencv/modules/core/src/algorithm.cpp:878–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argType, void* value) const
879{
880 const Param* p = findstr(data->params, parameter);
881 if( !p )
882 CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
883
884 GetSetParam f;
885 f.get_int = p->getter;
886
887 if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::SHORT
888 || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)
889 {
890 if( p->type == Param::INT )
891 {
892 if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
893 {
894 string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
895 CV_Error(CV_StsBadArg, message);
896 }
897 int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
898
899 if( argType == Param::INT )
900 *(int*)value = (int)val;
901 else if ( argType == Param::REAL )
902 *(double*)value = (double)val;
903 else if ( argType == Param::FLOAT)
904 *(float*)value = (float)val;
905 else if ( argType == Param::UNSIGNED_INT )
906 *(unsigned int*)value = (unsigned int)val;
907 else if ( argType == Param::UINT64 )
908 *(uint64*)value = (uint64)val;
909 else if ( argType == Param::UCHAR)
910 *(uchar*)value = (uchar)val;
911 else
912 CV_Error(CV_StsBadArg, "Wrong argument type");
913
914 }
915 else if( p->type == Param::SHORT )
916 {
917 if( argType != Param::INT )
918 {
919 string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
920 CV_Error(CV_StsBadArg, message);
921 }
922 int val = p->getter ? (algo->*f.get_int)() : *(short*)((uchar*)algo + p->offset);
923
924 *(int*)value = val;
925 }
926 else if( p->type == Param::BOOLEAN )
927 {
928 if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
929 {
930 string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
931 CV_Error(CV_StsBadArg, message);
932 }
933 bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
934
935 if( argType == Param::INT )

Callers

nothing calls this directly

Calls 3

findstrFunction · 0.85
nameMethod · 0.45

Tested by

no test coverage detected