Changeset 4889 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 09/08/04 18:49:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc
r4694 r4889 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // //27 // MWriteAsciiFile //28 // //29 // If you want to store a single container into an Ascii file you have //30 // to use this class. You must know the name of the file you wanne write //31 // (you should know it) and the name of the container you want to write. //32 // This can be the name of the class or a given name, which identifies //33 // the container in a parameter container list (MParList). //34 // The container is written to the ascii file if its ReadyToSave flag is //35 // set (MParContainer) //36 // //37 // You can write more than one container in one line of the file, see //38 // AddContainer. //39 // //40 // You can also write single data members of a container (like fWidth //41 // of MHillas). For more details see AddContainer. Make sure, that a //42 // getter method for the data member exist. The name of the method //43 // must be the same than the data member itself, but the f must be //44 // replaced by a Get. //45 // //26 // 27 // MWriteAsciiFile 28 // 29 // If you want to store a single container into an Ascii file you have 30 // to use this class. You must know the name of the file you wanne write 31 // (you should know it) and the name of the container you want to write. 32 // This can be the name of the class or a given name, which identifies 33 // the container in a parameter container list (MParList). 34 // The container is written to the ascii file if its ReadyToSave flag is 35 // set (MParContainer) 36 // 37 // You can write more than one container in one line of the file, see 38 // AddContainer. 39 // 40 // You can also write single data members of a container (like fWidth 41 // of MHillas). For more details see AddContainer. Make sure, that a 42 // getter method for the data member exist. The name of the method 43 // must be the same than the data member itself, but the f must be 44 // replaced by a Get. 45 // 46 46 ///////////////////////////////////////////////////////////////////////////// 47 48 47 #include "MWriteAsciiFile.h" 49 48 … … 51 50 52 51 #include <TMethodCall.h> // TMethodCall, AsciiWrite 52 53 #include "MIter.h" 53 54 54 55 #include "MDataList.h" // MDataList … … 190 191 Bool_t MWriteAsciiFile::CheckAndWrite() 191 192 { 193 MParContainer *obj = NULL; 194 195 // 196 // Check for the Write flag 197 // 198 Bool_t write = kFALSE; 199 MIter Next(&fList); 200 while ((obj=Next())) 201 if (obj->IsReadyToSave()) 202 { 203 write = kTRUE; 204 break; 205 } 206 207 // 208 // Do not write if not at least one ReadyToSave-flag set 209 // 210 if (!write) 211 return kTRUE; 212 192 213 Bool_t written = kFALSE; 193 194 MParContainer *obj = NULL;195 196 214 Int_t num = fList.GetEntries(); 197 215 198 TIter Next(&fList);199 while ((obj= (MParContainer*)Next()))216 Next.Reset(); 217 while ((obj=Next())) 200 218 { 201 // 202 // Check for the Write flag 203 // 204 if (!obj->IsReadyToSave()) 205 continue; 219 if (written) 220 *fOut << " "; 206 221 207 222 // … … 224 239 225 240 if (num!=0) 226 *fLog << warn << "W arning - given number of objects doesn't fit number of written objects." << endl;241 *fLog << warn << "WARNING - Number of objects written mismatch!" << endl; 227 242 } 228 243 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.