ENH: make objectRegistry::cfindIOobject public

This commit is contained in:
Mark Olesen
2021-11-15 22:13:21 +01:00
parent 28800dcbbc
commit 4e59ad9d8d
2 changed files with 31 additions and 37 deletions

View File

@ -77,29 +77,6 @@ bool Foam::objectRegistry::parentNotTime() const
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
const Foam::regIOobject* Foam::objectRegistry::cfindIOobject
(
const word& name,
const bool recursive
) const
{
const_iterator iter = cfind(name);
if (iter.found())
{
return iter.val();
}
else if (recursive && this->parentNotTime())
{
return parent_.cfindIOobject(name, recursive);
}
return nullptr;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::objectRegistry::objectRegistry(const Time& t, const label nObjects)
@ -424,6 +401,27 @@ void Foam::objectRegistry::rename(const word& newName)
}
const Foam::regIOobject* Foam::objectRegistry::cfindIOobject
(
const word& name,
const bool recursive
) const
{
const_iterator iter = cfind(name);
if (iter.found())
{
return iter.val();
}
else if (recursive && this->parentNotTime())
{
return parent_.cfindIOobject(name, recursive);
}
return nullptr;
}
bool Foam::objectRegistry::found
(
const word& name,

View File

@ -138,20 +138,6 @@ class objectRegistry
void operator=(const objectRegistry&) = delete;
// Protected Member Functions
//- Return const pointer to the regIOobject.
//
// \param recursive search parent registries
//
// \return nullptr if the object was not found.
const regIOobject* cfindIOobject
(
const word& name,
const bool recursive = false
) const;
public:
//- Declare type name for this IOobject
@ -355,6 +341,16 @@ public:
template<class Type>
HashTable<Type*> lookupClass(const bool strict = false);
//- Return const pointer to the regIOobject.
//
// \param recursive search parent registries
//
// \return nullptr if the object was not found.
const regIOobject* cfindIOobject
(
const word& name,
const bool recursive = false
) const;
//- Can the regIOobject object be found (by name).
//