Validator: add simple Result caching

This commit is contained in:
Bruno Martins
2019-05-29 14:22:47 -04:00
committed by mdavidsaver
parent e0d422ffd9
commit 31050952b6
18 changed files with 218 additions and 88 deletions

View File

@@ -146,13 +146,20 @@ Result& NTNDArrayAttribute::isAttribute(Result& result) {
.has<Scalar>("source");
}
static epicsThreadOnceId cachedResultOnceId = EPICS_THREAD_ONCE_INIT;
static epicsThreadPrivateId cachedResultId;
bool NTNDArrayAttribute::isCompatible(StructureConstPtr const & structure)
{
if (!structure)
return false;
Result result(structure);
return isAttribute(result.is<Structure>()).valid();
Result& result = Result::fromCache(&cachedResultOnceId, &cachedResultId);
if (result.wraps(structure))
return result.valid();
return isAttribute(result.reset(structure).is<Structure>()).valid();
}
bool NTNDArrayAttribute::isCompatible(PVStructurePtr const & pvStructure)