39 if (isA<Type>(*iter()))
41 objectNames[count++] = iter()->name();
59 if (isA<Type>(*iter()))
61 const word& objectName = iter()->name();
63 if (name.
match(objectName))
65 objectNames[count++] = objectName;
97 (strict && isType<Type>(*iter()))
98 || (!strict && isA<Type>(*iter()))
104 dynamic_cast<const Type*>(iter())
109 return objectsOfClass;
125 (strict && isType<Type>(*iter()))
126 || (!strict && isA<Type>(*iter()))
132 dynamic_cast<Type*>(iter())
137 return objectsOfClass;
148 const Type* vpsiPtr_ =
dynamic_cast<const Type*
>(iter());
155 else if (this->parentNotTime())
171 const Type* vpsiPtr_ =
dynamic_cast<const Type*
>(iter());
180 <<
" lookup of " << name <<
" from objectRegistry " 182 <<
" successful\n but it is not a " << Type::typeName
183 <<
", it is a " << iter()->type()
188 if (this->parentNotTime())
195 <<
" request for " << Type::typeName
196 <<
" " << name <<
" from objectRegistry " << this->
name()
197 <<
" failed\n available objects of type " << Type::typeName
205 <<
" request for " << name <<
" from objectRegistry " 206 << this->
name() <<
" to be cached failed" <<
nl 207 <<
" available temporary objects are" <<
nl 208 << temporaryObjects_;
215 return NullObjectRef<Type>();
222 return const_cast<Type&
>(lookupObject<Type>(
name));
226 template<
class Object>
229 readCacheTemporaryObjects();
231 if (cacheTemporaryObjects_.size())
233 temporaryObjects_.insert(ob.name());
237 cacheTemporaryObjects_.find(ob.name())
242 if (iter != cacheTemporaryObjects_.end() && iter().first() ==
false)
244 iter().first() =
true;
245 iter().second() =
true;
247 if (ob.db().template foundObject<Object>(ob.name()))
250 ob.db().template lookupObjectRef<Object>(ob.name());
253 if (&cachedOb != &ob && cachedOb.ownedByRegistry())
255 deleteCachedObject(cachedOb);
261 Info<<
"Caching " << ob.name()
262 <<
" of type " << ob.type() <<
endl;
267 store(
new Object(move(ob)));
bool cacheTemporaryObject(const word &name) const
Return true if given name is in the cacheTemporaryObjects set.
const word & name() const
Return name.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Type & lookupObjectRef(const word &name) const
Lookup and return the object reference of the given Type.
wordList names() const
Return the list of names of the IOobjects.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
bool foundObject(const word &name) const
Is the named Type found?
Operations on lists of strings.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
label size() const
Return number of elements in table.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const word &)
Find and return an iterator set at the hashedEntry.
A class for handling words, derived from string.
friend class const_iterator
Declare friendship with the const_iterator.
An STL-conforming hash table.
errorManip< error > abort(error &err)
A wordRe is a word, but can also have a regular expression for matching words.
void store()
Transfer ownership of this object to its registry.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
friend class iterator
Declare friendship with the iterator.
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.