1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Registry of regIOobjects
34 \*---------------------------------------------------------------------------*/
36 #ifndef objectRegistry_H
37 #define objectRegistry_H
39 #include "HashTable.H"
40 #include "regIOobject.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class objectRegistry Declaration
49 \*---------------------------------------------------------------------------*/
55 public HashTable<regIOobject*>
57 public HashTable<regIOobject*, word, string_hash>
62 //- Master time objectRegistry
65 //- Parent objectRegistry
66 const objectRegistry& parent_;
68 //- Local directory path of this objectRegistry relative to time
75 // Private Member Functions
77 //- Disallow Copy constructor
78 objectRegistry(const objectRegistry&);
80 //- Disallow default bitwise copy construct and assignment
81 void operator=(const objectRegistry&);
86 //- Declare type name for this IOobject
87 TypeName("objectRegistry");
92 //- Construct the time objectRegistry given an initial estimate
93 // for the number of entries
94 explicit objectRegistry
97 const label nIoObjects = 128
100 //- Construct a sub-registry given an IObject to describe the registry
101 // and an initial estimate for the number of entries
102 explicit objectRegistry
105 const label nIoObjects = 128
111 virtual ~objectRegistry();
119 const Time& time() const
124 //- Return the parent objectRegistry
125 const objectRegistry& parent() const
130 //- Local directory path of this objectRegistry relative to the time
131 virtual const fileName& dbDir() const
136 //- Return the list of names of the IOobjects
137 wordList names() const;
139 //- Return the list of names of the IOobjects of given class name
140 wordList names(const word& className) const;
142 //- Return the list of names of the IOobjects of given type
144 wordList names() const;
146 //- Lookup and return a const sub-objectRegistry
147 const objectRegistry& subRegistry(const word& name) const;
149 //- Lookup and return all the object of the given Type
151 HashTable<const Type*> lookupClass() const;
153 //- Is the named Type
155 bool foundObject(const word& name) const;
157 //- Lookup and return the object of the given Type
159 const Type& lookupObject(const word& name) const;
161 //- Return new event number.
162 label getEvent() const;
168 virtual void rename(const word& newName);
170 //- Add an regIOobject to registry
171 bool checkIn(regIOobject&) const;
173 //- Remove an regIOobject from registry
174 bool checkOut(regIOobject&) const;
179 //- Return true if any of the object's files have been modified
180 virtual bool modified() const;
182 //- Read the objects that have been modified
183 void readModifiedObjects();
185 //- Read object if modified
186 virtual bool readIfModified();
191 //- writeData function required by regIOobject but not used
192 // for this class, write is used instead
193 virtual bool writeData(Ostream&) const
197 "void objectRegistry::writeData(Ostream&) const: "
198 "use write() instead"
204 //- Write the objects
205 virtual bool writeObject
207 IOstream::streamFormat fmt,
208 IOstream::versionNumber ver,
209 IOstream::compressionType cmp
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 } // End namespace Foam
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 # include "objectRegistryTemplates.C"
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 // ************************************************************************* //