mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: make objectRegistry::cfindIOobject() protected instead of public
This commit is contained in:
committed by
Andrew Heather
parent
4e7ac82060
commit
f6d462a246
@ -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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::objectRegistry::objectRegistry(const Time& t, const label nObjects)
|
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
|
bool Foam::objectRegistry::modified() const
|
||||||
{
|
{
|
||||||
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
|
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
|
||||||
|
|||||||
@ -137,6 +137,20 @@ class objectRegistry
|
|||||||
void operator=(const objectRegistry&) = delete;
|
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:
|
public:
|
||||||
|
|
||||||
//- Declare type name for this IOobject
|
//- Declare type name for this IOobject
|
||||||
@ -347,52 +361,6 @@ public:
|
|||||||
bool found(const word& name, const bool recursive = false) const;
|
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?
|
//- Is the named Type found?
|
||||||
//
|
//
|
||||||
// \param recursive search parent registries
|
// \param recursive search parent registries
|
||||||
|
|||||||
Reference in New Issue
Block a user