34 template<
class ObjectType>
44 template<
class ObjectType>
54 template<
class ObjectType>
60 return obr().
findObject<ObjectType>(fieldName);
64 template<
class ObjectType>
75 template<
class ObjectType>
85 template<
class ObjectType>
95 template<
class ObjectType>
105 template<
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());
163 template<
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 Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Lookup and return non-const reference to the object of the given Type. Fatal if not found or the wron...
const ObjectType * cfindObject(const word &fieldName) const
Return const pointer to the object (eg, a field) in the (sub) objectRegistry.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const ObjectType & lookupObject(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
ObjectType & lookupObjectRef(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
ObjectType * getObjectPtr(const word &fieldName) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
bool foundObject(const word &fieldName) const
Find object (eg, a field) in the (sub) objectRegistry.
const ObjectType * findObject(const word &fieldName) const
Return const pointer to the object (eg, a field) in the (sub) objectRegistry.
#define WarningInFunction
Report a warning using Foam::Warning.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
Registry of regIOobjects.
virtual const objectRegistry & obr() const
The region or sub-region registry being used.
bool storeInDb(const word &fieldName, const tmp< ObjectType > &tfield, const objectRegistry &obr)
Store the field in an optional objectRegistry under the given name.