39 #ifndef Foam_objectRegistry_H 40 #define Foam_objectRegistry_H 83 mutable bool cacheTemporaryObjectsActive_;
101 void readCacheTemporaryObjects()
const;
109 template<
class MatchPredicate1,
class MatchPredicate2>
110 static label countImpl
113 const MatchPredicate1& matchClass,
114 const MatchPredicate2& matchName
119 template<
class Type,
class MatchPredicate>
120 static label countTypeImpl
123 const MatchPredicate& matchName
127 template<
class MatchPredicate>
131 const MatchPredicate& matchName
135 template<
class MatchPredicate1,
class MatchPredicate2>
139 const MatchPredicate1& matchClass,
140 const MatchPredicate2& matchName,
145 template<
class Type,
class MatchPredicate>
149 const MatchPredicate& matchName,
155 template<
class Type,
class MatchPredicate>
159 const MatchPredicate& matchName
231 template<
class MatchPredicate>
267 template<
class Type,
class MatchPredicate>
273 template<
class Type,
class MatchPredicate>
279 template<
class Type,
class MatchPredicate>
287 label
count(
const char* clsName)
const;
291 template<
class MatchPredicate>
292 label
count(
const MatchPredicate& matchClass)
const;
296 template<
class MatchPredicate1,
class MatchPredicate2>
299 const MatchPredicate1& matchClass,
300 const MatchPredicate2& matchName
312 label
count(
const bool strict =
false)
const;
318 template<
class Type,
class MatchPredicate>
319 label
count(
const MatchPredicate& matchName)
const;
333 template<
class MatchPredicate>
339 template<
class MatchPredicate1,
class MatchPredicate2>
342 const MatchPredicate1& matchClass,
343 const MatchPredicate2& matchName
356 template<
class Type,
class MatchPredicate>
371 template<
class MatchPredicate>
377 template<
class MatchPredicate1,
class MatchPredicate2>
380 const MatchPredicate1& matchClass,
381 const MatchPredicate2& matchName
394 template<
class Type,
class MatchPredicate>
407 const bool forceCreate =
false,
408 const bool recursive =
false 432 const bool recursive =
false 448 const bool recursive =
false 460 const bool recursive =
false 472 const bool recursive =
false 484 const bool recursive =
false 498 const bool recursive =
false 509 const bool recursive =
false 520 const bool recursive =
false 560 bool erase(
const iterator& iter);
570 label
erase(std::initializer_list<word>
keys);
631 const bool writeOnProc
640 return this->
contains(name, recursive);
650 bool recursive = false
653 return this->cfindObject<Type>(
name, recursive);
663 bool recursive = false
666 return this->getObjectPtr<Type>(
name, recursive);
bool contains(const word &name, const bool recursive=false) const
Does the registry contain the regIOobject object (by name).
UPtrList< const regIOobject > csorted() const
Return sorted list of objects.
bool cacheTemporaryObject(const word &name) const
True if given name is in the cacheTemporaryObjects set.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
A class for handling file names.
void readModifiedObjects()
Read the objects that have been modified.
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Lookup and return non-const reference to the object of the given Type. Fatal if not found or the wron...
const word & name() const noexcept
Return the object name.
bool erase(const iterator &iter)
Erase an entry specified by the given iterator.
wordList names() const
The unsorted names of all objects.
virtual bool modified() const
Return true if any of the object's files have been modified.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
A simple container for options an IOstream can normally have.
Operations on lists of strings.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const objectRegistry & subRegistry(const word &name, const bool forceCreate=false, const bool recursive=false) const
Lookup and return a const sub-objectRegistry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write the objects using stream options.
label count(const char *clsName) const
The number of objects of the given class name.
A class for handling words, derived from Foam::string.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
virtual bool writeData(Ostream &) const
The writeData function is required by regIOobject but not used.
const Time & time() const noexcept
Return time registry.
wordList sortedNames() const
The sorted names of all objects.
virtual ~objectRegistry()
Destructor, with checkOut() for all objects that are ownedByRegistry.
label getEvent() const
Return new event number.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
virtual bool readIfModified()
Read object if modified.
A HashTable similar to std::unordered_map.
bool checkCacheTemporaryObjects() const
Check that all objects specified in the cacheTemporaryObjects were also cached.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Type * lookupObjectRefPtr(const word &name, bool recursive=false) const
Deprecated(2018-10) get object pointer, ignoring constness.
bool isTimeDb() const noexcept
True if the registry is Time.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void resetCacheTemporaryObject(const regIOobject *io) const
Reset the cache state of the given object (nullptr is ignored)
bool checkOut()
Remove all file watches and remove object from registry.
TypeName("objectRegistry")
Declare type name for this IOobject.
void clearStorage()
Clear all entries from the registry and the table itself.
const Type * lookupObjectPtr(const word &name, bool recursive=false) const
Deprecated(2018-10) find object.
const objectRegistry & parent() const noexcept
Return the parent objectRegistry.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
void clear()
Clear all entries from the registry.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
bool found(const word &name, bool recursive=false) const
Same as contains()
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Registry of regIOobjects.
UPtrList< const regIOobject > sorted() const
Return sorted list of objects.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const objectRegistry & thisDb() const noexcept
Return the object registry.
HashTable< const Type * > lookupClass(const bool strict=false) const
Return all objects with a class satisfying isA<Type>
const_iterator_pair< const_key_iterator, this_type > keys() const
A const iterator begin/end pair for iterating over keys.
bool checkIn()
Add object to registry, if not already registered.
const regIOobject * cfindIOobject(const word &name, const bool recursive=false) const
Return const pointer to the regIOobject.
virtual void rename(const word &newName)
Rename.
HashTable< wordHashSet > classes() const
A summary hash of classes used and their associated object names.