31 template<
class ObjectType>
37 return obr_.foundObject<ObjectType>(fieldName);
48 <<
" functionObjects::" <<
type() <<
" " <<
name()
49 <<
" cannot find required object " << fieldName <<
" of type " 50 << Type::typeName <<
endl;
54 template<
class ObjectType>
60 return obr_.lookupObject<ObjectType>(fieldName);
64 template<
class ObjectType>
70 return obr_.lookupObjectRef<ObjectType>(fieldName);
74 template<
class ObjectType>
80 if (obr_.foundObject<ObjectType>(tfield->name()))
82 ObjectType&
field = obr_.lookupObjectRef<ObjectType>(tfield->name());
87 if (&field != &tfield())
93 obr_.objectRegistry::store(tfield.
ptr());
98 obr_.objectRegistry::store(tfield.
ptr());
105 template<
class ObjectType>
108 const word& fieldName,
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." 128 && obr_.foundObject<ObjectType>(fieldName)
131 ObjectType&
field = obr_.lookupObjectRef<ObjectType>(fieldName);
136 if (&field != &tfield())
142 obr_.objectRegistry::store(tfield.
ptr());
147 if (fieldName.size() && fieldName != tfield().name())
149 tfield.
ref().rename(fieldName);
152 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.
void cannotFindObject(const word &fieldName)
Prints a warning message that fieldName cannot be found.
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
T * ptr() const
Return tmp pointer for reuse.
A class for managing temporary objects.