31 template<
class ObjectType>
37 return obr_.foundObject<ObjectType>(fieldName);
41 template<
class ObjectType>
47 return obr_.lookupObject<ObjectType>(fieldName);
51 template<
class ObjectType>
57 return obr_.lookupObjectRef<ObjectType>(fieldName);
61 template<
class ObjectType>
67 if (obr_.foundObject<ObjectType>(tfield->name()))
69 ObjectType&
field = obr_.lookupObjectRef<ObjectType>(tfield->name());
74 if (&field != &tfield())
80 obr_.objectRegistry::store(tfield.
ptr());
85 obr_.objectRegistry::store(tfield.
ptr());
92 template<
class ObjectType>
95 const word& fieldName,
100 if (cacheable && fieldName == tfield().
name())
103 <<
"Cannot store cache-able field with the name used in the cache." 105 <<
" Either choose a different name or cache the field" 106 <<
" and use the 'writeObjects' functionObject." 115 && obr_.foundObject<ObjectType>(fieldName)
118 ObjectType&
field = obr_.lookupObjectRef<ObjectType>(fieldName);
123 if (&field != &tfield())
129 obr_.objectRegistry::store(tfield.
ptr());
134 if (fieldName.size() && fieldName != tfield().name())
136 tfield.
ref().rename(fieldName);
139 obr_.objectRegistry::store(tfield.
ptr());
T & ref() const
Return non-const reference or generate a fatal error.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const ObjectType & lookupObject(const word &fieldName) const
Lookup object from the objectRegistry.
A class for handling words, derived from string.
bool foundObject(const word &fieldName) const
Find field in the objectRegistry.
word name(const complex &)
Return a string representation of a complex.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
#define WarningInFunction
Report a warning using Foam::Warning.
ObjectType & lookupObjectRef(const word &fieldName)
Lookup non-const object reference from the objectRegistry.
T * ptr() const
Return tmp pointer for reuse.
A class for managing temporary objects.