some more fixes towards binary compatibility
This commit is contained in:
@@ -456,18 +456,27 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
|
||||
if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL )
|
||||
{
|
||||
CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN );
|
||||
CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN ||
|
||||
(p->type == Param::SHORT && argType == Param::INT) );
|
||||
|
||||
if( p->type == Param::INT )
|
||||
{
|
||||
int val = argType == Param::INT ? *(const int*)value :
|
||||
argType == Param::BOOLEAN ? (int)*(const bool*)value :
|
||||
saturate_cast<int>(*(const double*)value);
|
||||
argType == Param::BOOLEAN ? (int)*(const bool*)value :
|
||||
saturate_cast<int>(*(const double*)value);
|
||||
if( p->setter )
|
||||
(algo->*f.set_int)(val);
|
||||
else
|
||||
*(int*)((uchar*)algo + p->offset) = val;
|
||||
}
|
||||
else if( p->type == Param::SHORT )
|
||||
{
|
||||
int val = *(const int*)value;
|
||||
if( p->setter )
|
||||
(algo->*f.set_int)(val);
|
||||
else
|
||||
*(short*)((uchar*)algo + p->offset) = (short)val;
|
||||
}
|
||||
else if( p->type == Param::BOOLEAN )
|
||||
{
|
||||
bool val = argType == Param::INT ? *(const int*)value != 0 :
|
||||
@@ -554,6 +563,13 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
else
|
||||
*(double*)value = val;
|
||||
}
|
||||
else if( p->type == Param::SHORT )
|
||||
{
|
||||
CV_Assert( argType == Param::INT );
|
||||
int val = p->getter ? (algo->*f.get_int)() : *(short*)((uchar*)algo + p->offset);
|
||||
|
||||
*(int*)value = val;
|
||||
}
|
||||
else if( p->type == Param::BOOLEAN )
|
||||
{
|
||||
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL );
|
||||
@@ -639,7 +655,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp
|
||||
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
|
||||
argType == Param::REAL || argType == Param::STRING ||
|
||||
argType == Param::MAT || argType == Param::MAT_VECTOR ||
|
||||
argType == Param::ALGORITHM );
|
||||
argType == Param::ALGORITHM || argType == Param::SHORT );
|
||||
data->params.add(string(parameter), Param(argType, readOnly,
|
||||
(int)((size_t)value - (size_t)(void*)&algo),
|
||||
getter, setter, help));
|
||||
@@ -656,6 +672,16 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
short& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(int),
|
||||
const string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
bool& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
|
Reference in New Issue
Block a user