Changeset 2470 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 11/04/03 17:08:27 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r2416 r2470 163 163 // -------------------------------------------------------------------------- 164 164 // 165 // Returns the name of the object. If the name of the object is not the 166 // class name it returns the object name and in []-brackets the class name. 167 // 168 const char *MParContainer::GetDescriptor() const 169 { 170 // 171 // Because it returns a (const char*) we cannot return a casted 172 // local TString. The pointer would - immediatly after return - 173 // point to a random memory segment, because the TString has gone. 174 // 175 return fName==ClassName() ? ClassName() : Form("%s [%s]", fName.Data(), ClassName()); 176 } 177 178 // -------------------------------------------------------------------------- 179 // 165 180 // Return a unique name for this container. It is created from 166 181 // the container name and the unique Id. (This is mostly used -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r2416 r2470 74 74 virtual void FillBuffer(char *&buffer); 75 75 76 virtual const char *GetDescriptor() const { return fName==ClassName() ? ClassName() : Form("%s [%s]", fName.Data(), ClassName()); }76 virtual const char *GetDescriptor() const; 77 77 virtual const TString GetUniqueName() const; 78 78 virtual const char *GetName() const { return fName.Data(); } -
trunk/MagicSoft/Mars/mbase/MTask.cc
r2206 r2470 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MTask // 28 // // 29 // Base class for all tasks which can perfomed in a tasklist // 30 // For each event processed in the eventloop all the different // 31 // tasks in the tasklist will be processed. // 32 // // 33 // So all tasks must inherit from this baseclass. // 34 // // 35 // The inheritance from MInputStreamID is used to indicate the // 36 // type of event that this task is for. If it is "All" it is executed // 37 // independantly of the actual ID of the task list. // 38 // // 39 // Inside this abstract class, there are three fundamental function: // 40 // // 41 // - PreProcess(): executed before the eventloop starts. Here you // 42 // can initiate different things, open files, etc. // 43 // As an argument this function gets a pointer to the // 44 // parameter list. You can stop the execution by // 45 // returning kFALSE instead of kTRUE. If an error // 46 // occured and you return kFALSE make sure, that // 47 // any action is closed correctly and all newly // 48 // created object are deleted. The PostProcess in // 49 // such a case won't be executed by the Tasklist or // 50 // Eventloop. // 51 // // 52 // - Process(): executed for each event in the eventloop. Do it // 53 // one task after the other (as they occur in the // 54 // tasklist). Only the tasks with a Stream ID // 55 // which matches the actual ID of the tasklist // 56 // are executed. A task can return kFALSE to // 57 // stop the execuition of the tasklist or // 58 // kCONTINUE to skip the pending tasks. If you want // 59 // to stop the eventloop and wants the eventloop to // 60 // return the status 'failed' return kERROR. // 61 // // 62 // - PostProcess(): executed after the eventloop. Here you can close // 63 // output files, start display of the run parameter, // 64 // etc. PostProcess is only executed in case of // 65 // PreProcess was successfull (returned kTRUE) // 66 // // 26 // 27 // MTask 28 // 29 // Base class for all tasks which can perfomed in a tasklist 30 // For each event processed in the eventloop all the different 31 // tasks in the tasklist will be processed. 32 // 33 // So all tasks must inherit from this baseclass. 34 // 35 // The inheritance from MInputStreamID is used to indicate the 36 // type of event that this task is for. If it is "All" it is executed 37 // independantly of the actual ID of the task list. 38 // 39 // Inside this abstract class, there are three fundamental function: 40 // 41 // - PreProcess(): executed before the eventloop starts. Here you 42 // can initiate different things, open files, etc. 43 // As an argument this function gets a pointer to the 44 // parameter list. You can stop the execution by 45 // returning kFALSE instead of kTRUE. If an error 46 // occured and you return kFALSE make sure, that 47 // any action is closed correctly and all newly 48 // created object are deleted. The PostProcess in 49 // such a case won't be executed by the Tasklist or 50 // Eventloop. 51 // 52 // - Process(): executed for each event in the eventloop. Do it 53 // one task after the other (as they occur in the 54 // tasklist). Only the tasks with a Stream ID 55 // which matches the actual ID of the tasklist 56 // are executed. A task can return kFALSE to 57 // stop the execuition of the tasklist or 58 // kCONTINUE to skip the pending tasks. If you want 59 // to stop the eventloop and wants the eventloop to 60 // return the status 'failed' return kERROR. 61 // 62 // - PostProcess(): executed after the eventloop. Here you can close 63 // output files, start display of the run parameter, 64 // etc. PostProcess is only executed in case of 65 // PreProcess was successfull (returned kTRUE) 66 // 67 // Version 1: 68 // ---------- 69 // - first version 70 // 71 // Version 2: 72 // ---------- 73 // - added fSerialNumber 74 // 67 75 ///////////////////////////////////////////////////////////////////////////// 68 76 #include "MTask.h" … … 286 294 { 287 295 return kTRUE; 296 } 297 298 // -------------------------------------------------------------------------- 299 // 300 // Returns the name of the object. If the name of the object is not the 301 // class name it returns the object name and in []-brackets the class name. 302 // If a serial number is set (!=0) the serial number is added to the 303 // name (eg. ;1) 304 // 305 const char *MTask::GetDescriptor() const 306 { 307 // 308 // Because it returns a (const char*) we cannot return a casted 309 // local TString. The pointer would - immediatly after return - 310 // point to a random memory segment, because the TString has gone. 311 // 312 if (fName==ClassName()) 313 return fSerialNumber==0 ? ClassName() : Form("%s;%d", ClassName(), fSerialNumber); 314 315 return fSerialNumber>0 ? 316 Form("%s;%d [%s]", fName.Data(), fSerialNumber, ClassName()) : 317 Form("%s [%s]", fName.Data(), ClassName()); 288 318 } 289 319 … … 327 357 fFilter->SavePrimitive(out); 328 358 */ 329 out << " " << GetUniqueName() << ".SetFilter(&" << fFilter->GetUniqueName() <<");" << endl; 359 out << " " << GetUniqueName() << ".SetFilter(&" << fFilter->GetUniqueName() <<");" << endl; 360 if (fSerialNumber>0) 361 out << " " << GetUniqueName() << ".SetSerialNumber(" << fSerialNumber <<");" << endl; 330 362 } 331 363 -
trunk/MagicSoft/Mars/mbase/MTask.h
r2454 r2470 25 25 26 26 MFilter *fFilter; // Filter for conditional task execution 27 Byte_t fSerialNumber; // Serial number having more than one detector of the same type 27 28 28 29 Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList) … … 68 69 const MFilter *GetFilter() const { return fFilter; } 69 70 MFilter *GetFilter() { return fFilter; } // for MContinue only 71 70 72 void SetDisplay(MStatusDisplay *d); 71 73 virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const; 74 75 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; } 76 Byte_t GetSerialNumber() const { return fSerialNumber; } 77 TString AddSerialNumber(const char *str) const { TString s(str); if (fSerialNumber==0) return s; s += ";"; s += fSerialNumber; return s; } 78 TString AddSerialNumber(const TString &str) const { return AddSerialNumber((const char*)str); } 79 80 const char *GetDescriptor() const; 72 81 73 82 UInt_t GetNumExecutions() const { return fNumExecutions; } … … 85 94 void SavePrimitive(ofstream &out, Option_t *o=""); 86 95 87 ClassDef(MTask, 1) //Abstract base class for a task96 ClassDef(MTask, 2) //Abstract base class for a task 88 97 }; 89 98 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r2454 r2470 145 145 } 146 146 147 // -------------------------------------------------------------------------- 148 // 149 // Set the display for the all tasks in the list and the tasklist itself. 150 // 147 151 void MTaskList::SetDisplay(MStatusDisplay *d) 148 152 { 149 153 fTasks->ForEach(MTask, SetDisplay)(d); 150 154 MTask::SetDisplay(d); 155 } 156 157 // -------------------------------------------------------------------------- 158 // 159 // Set the serial number for the all tasks in the list and the tasklist 160 // itself. 161 // 162 void MTaskList::SetSerialNumber(Byte_t num) 163 { 164 fTasks->ForEach(MTask, SetSerialNumber)(num); 165 MTask::SetSerialNumber(num); 151 166 } 152 167 -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r2206 r2470 47 47 Bool_t AddToList(MTask *task, const char *tType="All"); 48 48 49 void SetSerialNumber(Byte_t num); 50 49 51 Bool_t RemoveFromList(MTask *task); 50 52
Note:
See TracChangeset
for help on using the changeset viewer.