![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 regIOobject 00027 00028 Description 00029 regIOobject is an abstract class derived from IOobject to handle 00030 automatic object registration with the objectRegistry. 00031 00032 SourceFiles 00033 regIOobject.C 00034 regIOobjectRead.C 00035 regIOobjectWrite.C 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef regIOobject_H 00040 #define regIOobject_H 00041 00042 #include "IOobject.H" 00043 #include "typeInfo.H" 00044 #include "OSspecific.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 /*---------------------------------------------------------------------------*\ 00052 Class regIOobject Declaration 00053 \*---------------------------------------------------------------------------*/ 00054 00055 class regIOobject 00056 : 00057 public IOobject 00058 { 00059 00060 private: 00061 00062 // Private data 00063 00064 //- Is this object registered with the registry 00065 bool registered_; 00066 00067 //- Is this object owned by the registry 00068 bool registries_; 00069 00070 //- Time of last modification 00071 mutable time_t lastModified_; 00072 00073 //- Istream for reading 00074 Istream* isPtr_; 00075 00076 00077 // Private member functions 00078 00079 //- Return Istream 00080 Istream& readStream(); 00081 00082 //- Dissallow assignment 00083 void operator=(const regIOobject&); 00084 00085 00086 public: 00087 00088 // Static data 00089 00090 //- Runtime type information 00091 TypeName("regIOobject"); 00092 00093 static int fileModificationSkew; 00094 00095 00096 // Constructors 00097 00098 //- Construct from IOobject 00099 regIOobject(const IOobject&); 00100 00101 //- Construct as copy 00102 regIOobject(const regIOobject&); 00103 00104 //- Construct as copy, and transfering registry registration to copy 00105 // if registerCopy is true 00106 regIOobject(const regIOobject&, bool registerCopy); 00107 00108 00109 // Destructor 00110 00111 virtual ~regIOobject(); 00112 00113 00114 // Member functions 00115 00116 // Registration 00117 00118 //- Register object with registry 00119 void checkIn(); 00120 00121 //- Check-out object from registry 00122 void checkOut(); 00123 00124 //- Is this object owned by the registry 00125 bool registries() const 00126 { 00127 return registries_; 00128 } 00129 00130 //- Transfer ownership of this object to it's registry 00131 void transferToRegistry() 00132 { 00133 registries_ = true; 00134 } 00135 00136 00137 // Edit 00138 00139 //- Rename 00140 virtual void rename(const word& newName); 00141 00142 00143 // Reading 00144 00145 //- Return Istream and check object type against that given 00146 Istream& readStream(const word&); 00147 00148 //- Close Istream 00149 void close(); 00150 00151 //- Virtual readData function. 00152 // Must be defined in derived types for which 00153 // re-reading is required 00154 virtual bool readData(Istream&); 00155 00156 //- Read object 00157 virtual bool read(); 00158 00159 //- Read object if modified 00160 virtual bool readIfModified(); 00161 00162 00163 // Writing 00164 00165 //- Pure virtual writaData function. 00166 // Must be defined in derived types 00167 virtual bool writeData(Ostream&) const = 0; 00168 00169 //- Write using given format, version and compression 00170 virtual bool write 00171 ( 00172 IOstream::streamFormat fmt, 00173 IOstream::versionNumber ver, 00174 IOstream::compressionType cmp 00175 ) const; 00176 00177 //- Write using setting from DB 00178 bool write() const; 00179 00180 00181 // Member operators 00182 00183 void operator=(const IOobject&); 00184 }; 00185 00186 00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00188 00189 } // End namespace Foam 00190 00191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00192 00193 #endif 00194 00195 // ************************************************************************* //