34template<
class ObjectType>
44template<
class ObjectType>
50 return obr().cfindObject<ObjectType>(fieldName);
54template<
class ObjectType>
60 return obr().findObject<ObjectType>(fieldName);
64template<
class ObjectType>
71 return obr().getObjectPtr<ObjectType>(fieldName);
75template<
class ObjectType>
81 return obr().getObjectPtr<ObjectType>(fieldName);
85template<
class ObjectType>
91 return obr().lookupObject<ObjectType>(fieldName);
95template<
class ObjectType>
101 return obr().lookupObjectRef<ObjectType>(fieldName);
105template<
class ObjectType>
113 if (cacheable && fieldName == tfield().
name())
116 <<
"Cannot store cache-able field with the name used in the cache."
118 <<
" Either choose a different name or cache the field"
119 <<
" and use the 'writeObjects' functionObject."
125 ObjectType* fieldptr;
130 && (fieldptr = getObjectPtr<ObjectType>(fieldName)) !=
nullptr
136 if (fieldptr != &tfield())
138 (*fieldptr) = tfield;
142 obr().objectRegistry::store(tfield.
ptr());
147 if (fieldName.size() && fieldName != tfield().
name())
149 tfield.
ref().rename(fieldName);
153 fieldName = tfield().name();
156 obr().objectRegistry::store(tfield.
ptr());
163template<
class ObjectType>
166 const word& fieldName,
171 ObjectType* fieldptr;
175 && (fieldptr = obr.
getObjectPtr<ObjectType>(fieldName)) !=
nullptr
178 (*fieldptr) = tfield;
182 tfield.
ref().rename(fieldName);
183 obr.objectRegistry::store(tfield.
ptr());
const ObjectType & lookupObject(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
const ObjectType * cfindObject(const word &fieldName) const
bool foundObject(const word &fieldName) const
Find object (eg, a field) in the (sub) objectRegistry.
ObjectType * getObjectPtr(const word &fieldName) const
virtual const objectRegistry & obr() const
The region or sub-region registry being used.
const ObjectType * findObject(const word &fieldName) const
bool storeInDb(const word &fieldName, const tmp< ObjectType > &tfield, const objectRegistry &obr)
Store the field in an optional objectRegistry under the given name.
ObjectType & lookupObjectRef(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
Registry of regIOobjects.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Type * getObjectPtr(const word &name, const bool recursive=false) const
A class for managing temporary objects.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)