Increase the effectiveness of checking all values.
This commit is contained in:
parent
725a8c2e57
commit
c2f04c487e
|
@ -31,6 +31,7 @@ struct MYNTEYE_API Object {
|
||||||
virtual ~Object() = default;
|
virtual ~Object() = default;
|
||||||
|
|
||||||
virtual Object *Clone() const = 0;
|
virtual Object *Clone() const = 0;
|
||||||
|
virtual bool DecValidity() const = 0;
|
||||||
|
|
||||||
/** Cast the obj to T pointer */
|
/** Cast the obj to T pointer */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -65,6 +66,10 @@ struct MYNTEYE_API ObjMat : public Object {
|
||||||
mat->value = value.clone();
|
mat->value = value.clone();
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DecValidity() const {
|
||||||
|
return !value.empty();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +92,10 @@ struct MYNTEYE_API ObjMat2 : public Object {
|
||||||
mat2->second = second.clone();
|
mat2->second = second.clone();
|
||||||
return mat2;
|
return mat2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DecValidity() const {
|
||||||
|
return !first.empty() && !second.empty();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MYNTEYE_END_NAMESPACE
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
|
@ -130,6 +130,10 @@ bool Processor::Process(const Object &in) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!in.DecValidity()){
|
||||||
|
LOG(WARNING) << "Input is invalid";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(mtx_input_ready_);
|
std::lock_guard<std::mutex> lk(mtx_input_ready_);
|
||||||
input_.reset(in.Clone());
|
input_.reset(in.Clone());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user