objectRegistry: Added member function to query and add to the cached temporary objects list

This commit is contained in:
Henry Weller
2019-07-23 11:45:53 +01:00
parent 94642ba4d9
commit eef560b883
2 changed files with 29 additions and 1 deletions

View File

@ -333,6 +333,27 @@ void Foam::objectRegistry::clear()
}
void Foam::objectRegistry::addTemporaryObject
(
const word& name
) const
{
if (!cacheTemporaryObjects_.found(name))
{
cacheTemporaryObjects_.insert(name, {false, false});
}
}
bool Foam::objectRegistry::cacheTemporaryObject
(
const word& name
) const
{
return cacheTemporaryObjects_.found(name);
}
void Foam::objectRegistry::resetCacheTemporaryObject
(
const regIOobject& ob

View File

@ -214,10 +214,17 @@ public:
//- Remove all regIOobject owned by the registry
void clear();
//- Add the given name to the set of temporary objects to cache
void addTemporaryObject(const word& name) const;
//- Return true if given name is in the cacheTemporaryObjects set
bool cacheTemporaryObject(const word& name) const;
//- Cache the given object
template<class Object>
bool cacheTemporaryObject(Object& ob) const;
//- Reset cache state of the given object
//- Reset the cache state of the given object
// in the cacheTemporaryObjects set
void resetCacheTemporaryObject(const regIOobject& ob) const;