Changeset 850 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 06/13/01 13:09:40 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
r844 r850 50 50 // -------------------------------------------------------------------------- 51 51 // 52 // Default constructor.53 52 // Specify the name of the ascii output file 'filename' and the name 54 53 // of the container you want to write. (Normally this is the name … … 57 56 // 58 57 MWriteAsciiFile::MWriteAsciiFile(const char *filename, const char *contname, 59 const char *name, const char *title) : fOut(NULL) 58 const char *name, const char *title) 59 : fOut(NULL), fContainer(NULL) 60 60 { 61 61 *fName = name ? name : "MWriteAsciiFile"; … … 64 64 fNameFile = filename; 65 65 fNameContainer = contname; 66 } 67 68 // -------------------------------------------------------------------------- 69 // 70 // Specify a the name of the ascii output file 'filename' and a pointer to 71 // the container you want to write. 72 // 73 MWriteAsciiFile::MWriteAsciiFile(const char *filename, MParContainer *cont, 74 const char *name, const char *title) 75 : fOut(NULL), fContainer(cont) 76 { 77 *fName = name ? name : "MWriteAsciiFile"; 78 *fTitle = title ? title : "Task to write one container to an ascii file"; 79 80 fNameFile = filename; 81 fNameContainer = cont->GetName(); 66 82 } 67 83 … … 86 102 Bool_t MWriteAsciiFile::PreProcess (MParList *pList) 87 103 { 104 // 105 // Try to find the container which should be stored. 106 // 107 if (!fContainer) 108 { 109 fContainer = (MParContainer*)pList->FindObject(fNameContainer); 110 if (!fContainer) 111 { 112 *fLog << dbginf << "Cannot find parameter container '" << fContainer << "'." << endl; 113 return kFALSE; 114 } 115 } 116 117 // 118 // Try to open the output file 119 // 88 120 fOut = new ofstream(fNameFile); 89 121 … … 96 128 *fLog << "Ascii file '" << fNameFile << "' opened for writing." << endl; 97 129 98 fContainer = (MParContainer*)pList->FindObject(fNameContainer); 99 if (!fContainer) 100 { 101 *fLog << dbginf << "Cannot find parameter container '" << fContainer << "'." << endl; 102 return kFALSE; 103 } 104 130 // 131 // write the container if it is already in changed state 132 // 105 133 if (fContainer->HasChanged()) 106 134 fContainer->AsciiWrite(*fOut); … … 133 161 Bool_t MWriteAsciiFile::PostProcess() 134 162 { 163 // 164 // check if the container changed state is set 165 // 135 166 if (fContainer->HasChanged()) 136 167 fContainer->AsciiWrite(*fOut); 137 168 169 // 170 // delete (close) file 171 // 138 172 delete fOut; 139 173 fOut = NULL; -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h
r844 r850 10 10 private: 11 11 ofstream *fOut; 12 TString fNameFile; 13 TString fNameContainer; 12 13 TString fNameFile; 14 TString fNameContainer; 14 15 15 16 MParContainer *fContainer; 16 17 17 18 public: 18 MWriteAsciiFile(const char *filename, const char *contname, const char *name=NULL, const char *title=NULL); 19 MWriteAsciiFile(const char *filename, const char *contname, 20 const char *name=NULL, const char *title=NULL); 21 MWriteAsciiFile(const char *filename, MParContainer *cont, 22 const char *name=NULL, const char *title=NULL); 19 23 ~MWriteAsciiFile(); 20 24
Note:
See TracChangeset
for help on using the changeset viewer.