1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Registry of regIOobjects
33 \*---------------------------------------------------------------------------*/
35 #ifndef objectRegistry_H
36 #define objectRegistry_H
38 #include "HashTable.H"
39 #include "regIOobject.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class objectRegistry Declaration
48 \*---------------------------------------------------------------------------*/
54 public HashTable<regIOobject*>
56 public HashTable<regIOobject*, word, string_hash>
61 //- Master time objectRegistry
64 //- Parent objectRegistry
65 const objectRegistry& parent_;
67 //- Local directory path of this objectRegistry relative to time
74 // Private Member Functions
76 //- Disallow Copy constructor
77 objectRegistry(const objectRegistry&);
79 //- Disallow default bitwise copy construct and assignment
80 void operator=(const objectRegistry&);
85 //- Declare type name for this IOobject
86 TypeName("objectRegistry");
91 //- Construct the time objectRegistry given an initial estimate
92 // for the number of entries
93 explicit objectRegistry
96 const label nIoObjects = 128
99 //- Construct a sub-registry given an IObject to describe the registry
100 // and an initial estimate for the number of entries
101 explicit objectRegistry
104 const label nIoObjects = 128
107 //- Construct a sub-registry given an IObject to describe the registry
108 // and an initial estimate for the number of entries
109 explicit objectRegistry
112 const fileName& dbDir,
113 const label nIoObjects = 128
118 virtual ~objectRegistry();
126 const Time& time() const;
128 //- Return the parent objectRegistry
129 const objectRegistry& parent() const
134 //- Local directory path of this objectRegistry
135 // relative to the time
136 virtual const fileName& dbDir() const
146 //- Return mangled fileName
147 virtual fileName mangleFileName(const fileName&) const;
149 //- Return the list of names of the IOobjects
150 wordList names() const;
152 //- Return the list of names of the IOobjects of given class name
153 wordList names(const word& className) const;
155 //- Return the list of names of the IOobjects of given type
157 wordList names() const;
159 //- Lookup and return a const sub-objectRegistry
160 const objectRegistry& subRegistry(const word& name) const;
162 //- Lookup and return all the object of the given Type
164 HashTable<const Type*> lookupClass() const;
166 //- Is the named Type
168 bool foundObject(const word& name) const;
170 //- Lookup and return the object of the given Type
172 const Type& lookupObject(const word& name) const;
174 //- Return new event number.
175 label getEvent() const;
181 virtual void rename(const word& newName);
183 //- Add an regIOobject to registry
184 virtual bool checkIn(regIOobject&) const;
186 //- Remove an regIOobject from registry
187 virtual bool checkOut(regIOobject&) const;
192 //- Return true if any of the object's files have been modified
193 virtual bool modified() const;
195 //- Read the objects that have been modified
196 void readModifiedObjects();
198 //- Read object if modified
199 virtual bool readIfModified();
204 //- writeData function required by regIOobject but not used
205 // for this class, write is used instead
206 virtual bool writeData(Ostream&) const
210 "void objectRegistry::writeData(Ostream&) const: "
211 "use write() instead"
217 //- Write the objects
218 virtual bool writeObject
220 IOstream::streamFormat fmt,
221 IOstream::versionNumber ver,
222 IOstream::compressionType cmp
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 } // End namespace Foam
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 # include "objectRegistryTemplates.C"
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 // ************************************************************************* //