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