39 #ifndef Foam_objectRegistry_H 40 #define Foam_objectRegistry_H 90 template<
class MatchPredicate1,
class MatchPredicate2>
91 static label countImpl
94 const MatchPredicate1& matchClass,
95 const MatchPredicate2& matchName
100 template<
class Type,
class MatchPredicate>
101 static label countTypeImpl
104 const MatchPredicate& matchName
108 template<
class MatchPredicate>
112 const MatchPredicate& matchName
116 template<
class MatchPredicate1,
class MatchPredicate2>
120 const MatchPredicate1& matchClass,
121 const MatchPredicate2& matchName,
126 template<
class Type,
class MatchPredicate>
130 const MatchPredicate& matchName,
136 template<
class Type,
class MatchPredicate>
140 const MatchPredicate& matchName
212 template<
class MatchPredicate>
248 template<
class Type,
class MatchPredicate>
254 template<
class Type,
class MatchPredicate>
260 template<
class Type,
class MatchPredicate>
268 label
count(
const char* clsName)
const;
272 template<
class MatchPredicate>
273 label
count(
const MatchPredicate& matchClass)
const;
277 template<
class MatchPredicate1,
class MatchPredicate2>
280 const MatchPredicate1& matchClass,
281 const MatchPredicate2& matchName
293 label
count(
const bool strict =
false)
const;
299 template<
class Type,
class MatchPredicate>
300 label
count(
const MatchPredicate& matchName)
const;
314 template<
class MatchPredicate>
320 template<
class MatchPredicate1,
class MatchPredicate2>
323 const MatchPredicate1& matchClass,
324 const MatchPredicate2& matchName
337 template<
class Type,
class MatchPredicate>
352 template<
class MatchPredicate>
358 template<
class MatchPredicate1,
class MatchPredicate2>
361 const MatchPredicate1& matchClass,
362 const MatchPredicate2& matchName
375 template<
class Type,
class MatchPredicate>
388 const bool forceCreate =
false,
389 const bool recursive =
false 413 const bool recursive =
false 419 bool found(
const word&
name,
const bool recursive =
false)
const;
429 const bool recursive =
false 441 const bool recursive =
false 453 const bool recursive =
false 465 const bool recursive =
false 479 const bool recursive =
false 490 const bool recursive =
false 501 const bool recursive =
false 541 bool erase(
const iterator& iter);
551 label
erase(std::initializer_list<word>
keys);
601 bool recursive = false
604 return this->cfindObject<Type>(
name, recursive);
614 bool recursive = false
617 return this->getObjectPtr<Type>(
name, recursive);
bool found(const word &name, const bool recursive=false) const
Can the regIOobject object be found (by name).
UPtrList< const regIOobject > csorted() const
Return sorted list of objects.
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...
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write the objects using stream options.
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
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
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
writeData function 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.
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...
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...
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?
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.