Commit f6d462a2 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

STYLE: make objectRegistry::cfindIOobject() protected instead of public

parent 4e7ac820
......@@ -76,6 +76,29 @@ 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)
......@@ -383,57 +406,6 @@ bool Foam::objectRegistry::found
}
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;
}
const Foam::regIOobject* Foam::objectRegistry::findIOobject
(
const word& name,
const bool recursive
) const
{
return cfindIOobject(name, recursive);
}
Foam::regIOobject* Foam::objectRegistry::findIOobject
(
const word& name,
const bool recursive
)
{
return const_cast<regIOobject*>(cfindIOobject(name, recursive));
}
Foam::regIOobject* Foam::objectRegistry::getIOobjectPtr
(
const word& name,
const bool recursive
) const
{
return const_cast<regIOobject*>(cfindIOobject(name, recursive));
}
bool Foam::objectRegistry::modified() const
{
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
......
......@@ -137,6 +137,20 @@ 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
......@@ -347,52 +361,6 @@ public:
bool found(const word& name, const bool recursive = false) const;
//- 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;
//- Return const pointer to the regIOobject.
//
// \param recursive search parent registries
//
// \return nullptr if the object was not found.
const regIOobject* findIOobject
(
const word& name,
const bool recursive = false
) const;
//- Return non-const pointer to the regIOobject.
//
// \param recursive search parent registries
//
// \return nullptr if the object was not found.
regIOobject* findIOobject
(
const word& name,
const bool recursive = false
);
//- Return non-const pointer to the regIOobject,
//- using a const-cast to have it behave like a mutable.
// Exercise caution when using.
//
// \param recursive search parent registries.
//
// \return nullptr if the object was not found.
regIOobject* getIOobjectPtr
(
const word& name,
const bool recursive = false
) const;
//- Is the named Type found?
//
// \param recursive search parent registries
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment