31 template<
class ObjectType>
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());
const ObjectType & lookupObject(const word &fieldName) const
Lookup object from the objectRegistry.
bool foundObject(const word &fieldName) const
Find field in the objectRegistry.
const objectRegistry & obr_
Reference to the region objectRegistry.
ObjectType & lookupObjectRef(const word &fieldName)
Lookup non-const object reference from the objectRegistry.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
void cannotFindObject(const word &fieldName)
Prints a warning message that fieldName cannot be found.
bool foundObject(const word &name) const
Is the named Type in registry.
A class for managing temporary objects.
T * ptr() const
Return tmp pointer for reuse.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.