Ignore:
Timestamp:
10/05/01 14:39:20 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MClone.cc

    r959 r961  
    2525//////////////////////////////////////////////////////////////////////////////
    2626//                                                                          //
     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//   -/-                                                                    //
    2747//                                                                          //
    2848//////////////////////////////////////////////////////////////////////////////
     
    5272// --------------------------------------------------------------------------
    5373//
    54 // Constructor.
     74//  Constructor. Remembers the name to search for in the parameter list.
    5575//
    5676MClone::MClone(const char *par, const char *name, const char *title)
     
    6383// --------------------------------------------------------------------------
    6484//
    65 // Constructor.
     85//  Constructor. Remember the pointer of the object which has to be cloned.
    6686//
    6787MClone::MClone(const MParContainer *par, const char *name, const char *title)
     
    7494// --------------------------------------------------------------------------
    7595//
    76 // Destructor.
     96//  Destructor. Deletes the cloned object.
    7797//
    7898MClone::~MClone()
     
    83103// --------------------------------------------------------------------------
    84104//
    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.
    90107//
    91108Bool_t MClone::PreProcess(MParList *pList)
    92109{
    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;
    103128}
    104129
     130// --------------------------------------------------------------------------
     131//
     132//  Delete the cloned object if one is existing
     133//
    105134void MClone::Clear(Option_t *)
    106135{
     136    //
     137    // Check if an object has been initialized
     138    //
    107139    if (!fClone)
    108140        return;
    109141
     142    //
     143    // Delete it and set the pointer to NULL for the sanity check (above)
     144    //
    110145    delete fClone;
    111146    fClone = NULL;
     
    114149// --------------------------------------------------------------------------
    115150//
    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.
    117153//
    118154Bool_t MClone::Process()
    119155{
     156    //
     157    // Delete an existing clone
     158    //
    120159    Clear();
    121160
     161    //
     162    // Clone the given parameter container
     163    //
    122164    fClone = fParContainer->Clone();
    123165
Note: See TracChangeset for help on using the changeset viewer.