Changeset 961 for trunk/MagicSoft/Mars/mbase/MClone.cc
- Timestamp:
- 10/05/01 14:39:20 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MClone.cc
r959 r961 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // // 27 // MClone // 28 // // 29 // This task clones a given paramter container. You can either specify // 30 // the name of the container which should be cloned or a pointer to the // 31 // container. If you specify a name the preprocessing tries to find the // 32 // corresponding container in the parameter list. // 33 // Cloning in this context means duplicating the object in memory. This // 34 // may be used if you change an object in the eventloop (eg. the image // 35 // cleaning is changing the image) and you want to compare both 'version' // 36 // of this object afterwards. // 37 // The cloned object can be accessed by using MClone::GetClone. // 38 // To clone the container more than once use several instances of MClone. // 39 // The object does only exist until a new object is cloned. It is deleted // 40 // in the destructor. // 41 // // 42 // Input Containers: // 43 // MParContainer // 44 // // 45 // Output Containers: // 46 // -/- // 27 47 // // 28 48 ////////////////////////////////////////////////////////////////////////////// … … 52 72 // -------------------------------------------------------------------------- 53 73 // 54 // Constructor.74 // Constructor. Remembers the name to search for in the parameter list. 55 75 // 56 76 MClone::MClone(const char *par, const char *name, const char *title) … … 63 83 // -------------------------------------------------------------------------- 64 84 // 65 // Constructor.85 // Constructor. Remember the pointer of the object which has to be cloned. 66 86 // 67 87 MClone::MClone(const MParContainer *par, const char *name, const char *title) … … 74 94 // -------------------------------------------------------------------------- 75 95 // 76 // Destructor.96 // Destructor. Deletes the cloned object. 77 97 // 78 98 MClone::~MClone() … … 83 103 // -------------------------------------------------------------------------- 84 104 // 85 // Checks the parameter list for the existance of the parameter container. If 86 // the name of it was given in the constructor. It checks also for the 87 // existance of the histogram container in the parameter list if a name was 88 // given. If it is not available it tried to create a histogram container 89 // with the same type as the given object name. 105 // Checks the parameter list for the existance of the parameter container. If 106 // the name of it was given in the constructor. 90 107 // 91 108 Bool_t MClone::PreProcess(MParList *pList) 92 109 { 93 if (!fParContainer) 94 { 95 fParContainer = (MParContainer*)pList->FindObject(fParContainerName); 96 if (!fParContainer) 97 { 98 *fLog << dbginf << fParContainerName << " not found... aborting." << endl; 99 return kFALSE; 100 } 101 } 102 return kTRUE; 110 // 111 // The pointer is already given by the user. 112 // 113 if (fParContainer) 114 return kTRUE; 115 116 // 117 // Try to find the parameter container with the given name in the list 118 // 119 fParContainer = (MParContainer*)pList->FindObject(fParContainerName); 120 if (fParContainer) 121 return kTRUE; 122 123 // 124 // If it couldn't get found stop Eventloop 125 // 126 *fLog << dbginf << fParContainerName << " not found... aborting." << endl; 127 return kFALSE; 103 128 } 104 129 130 // -------------------------------------------------------------------------- 131 // 132 // Delete the cloned object if one is existing 133 // 105 134 void MClone::Clear(Option_t *) 106 135 { 136 // 137 // Check if an object has been initialized 138 // 107 139 if (!fClone) 108 140 return; 109 141 142 // 143 // Delete it and set the pointer to NULL for the sanity check (above) 144 // 110 145 delete fClone; 111 146 fClone = NULL; … … 114 149 // -------------------------------------------------------------------------- 115 150 // 116 // Fills the data from the parameter conatiner into the histogram container 151 // Deletes an existing clone and clones the object (parameter container) 152 // again. 117 153 // 118 154 Bool_t MClone::Process() 119 155 { 156 // 157 // Delete an existing clone 158 // 120 159 Clear(); 121 160 161 // 162 // Clone the given parameter container 163 // 122 164 fClone = fParContainer->Clone(); 123 165
Note:
See TracChangeset
for help on using the changeset viewer.