39 if (isA<Type>(*iter()))
41 objectNames[
count++] = iter()->name();
59 if (isA<Type>(*iter()))
61 const word& objectName = iter()->name();
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;
144 const_iterator iter = find(
name);
148 const Type* vpsiPtr_ =
dynamic_cast<const Type*
>(iter());
155 else if (this->parentNotTime())
157 return parent_.foundObject<Type>(
name);
167 const_iterator iter = find(
name);
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())
190 return parent_.lookupObject<Type>(
name);
195 <<
" request for " << Type::typeName
196 <<
" " <<
name <<
" from objectRegistry " << this->
name()
197 <<
" failed\n available objects of type " << Type::typeName
201 if (cacheTemporaryObject(
name))
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));
240 template<
class Object>
243 readCacheTemporaryObjects();
245 if (cacheTemporaryObjects_.size())
247 temporaryObjects_.insert(ob.name());
251 cacheTemporaryObjects_.find(ob.name())
256 if (iter != cacheTemporaryObjects_.
end() && iter().
first() ==
false)
258 iter().first() =
true;
259 iter().second() =
true;
261 if (ob.db().template foundObject<Object>(ob.name()))
264 ob.db().template lookupObjectRef<Object>(ob.name());
267 if (&cachedOb != &ob && cachedOb.ownedByRegistry())
269 deleteCachedObject(cachedOb);
275 Info<<
"Caching " << ob.name()
276 <<
" of type " << ob.type() <<
endl;
281 store(
new Object(move(ob)));
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
static word groupName(Name name, const word &group)
void setSize(const label)
Reset size of List.
wordList toc() const
Return the list of names of the IOobjects of given type.
Type & lookupObjectRef(const word &name) const
Lookup and return the object reference of the given Type.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
bool foundType(const word &group=word::null) const
Is the Type in registry.
bool cacheTemporaryObject(const word &name) const
Return true if given name is in the cacheTemporaryObjects set.
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
const Type & lookupType(const word &group=word::null) const
Lookup and return the object of the given Type.
bool foundObject(const word &name) const
Is the named Type in registry.
bool match(const std::string &) const
True when strings match literally.
A wordRe is a word, but can also have a regular expression for matching words.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const char *const group
Group name for atomic constants.
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)
labelList first(const UList< labelPair > &p)
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
Operations on lists of strings.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable