Ignore:
Timestamp:
10/02/01 14:46:56 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r858 r959  
    3131#pragma link C++ class MInputStreamID;
    3232
     33#pragma link C++ class MClone;
     34
    3335#pragma link C++ class MReadTree;
    3436#pragma link C++ class MWriteFile;
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r887 r959  
    8181MEvtLoop::~MEvtLoop()
    8282{
     83    if (TestBit(kIsOwner) && fParList)
     84        delete fParList;
     85}
     86
     87// --------------------------------------------------------------------------
     88//
     89//  if you set the Eventloop as owner the destructor of the given parameter
     90//  list is calles by the destructor of MEvtLoop, otherwise not.
     91//
     92inline void MEvtLoop::SetOwner(Bool_t enable=kTRUE)
     93{
     94    enable ? SetBit(kIsOwner) : ResetBit(kIsOwner);
    8395}
    8496
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r867 r959  
    2727    MTaskList *fTaskList;
    2828
     29    enum { kIsOwner = BIT(14) };
     30
    2931public:
    3032    MEvtLoop();
    3133    virtual ~MEvtLoop();
    3234
    33     void SetParList(MParList *p)  { fParList = p; }
     35    void SetParList(MParList *p)        { fParList = p; }
     36    MParList *GetParList() const        { return fParList; }
     37
     38    void SetOwner(Bool_t enable=kTRUE);
    3439
    3540    Bool_t PreProcess(const char *tlist="MTaskList");
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r905 r959  
    8181// --------------------------------------------------------------------------
    8282//
     83//  If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted
     84//  by the destructor
     85//
     86MParList::~MParList()
     87{
     88    if (TestBit(kIsOwner))
     89        fContainer.SetOwner();
     90}
     91
     92// --------------------------------------------------------------------------
     93//
     94//  If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted
     95//  by the destructor
     96//
     97inline void MParList::SetOwner(Bool_t enable=kTRUE)
     98{
     99    enable ? SetBit(kIsOwner) : ResetBit(kIsOwner);
     100}
     101
     102// --------------------------------------------------------------------------
     103//
    83104//  Set the logging streamer of the parameter list and all contained
    84105//  parameter containers
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r891 r959  
    3232    static TString GetObjectName(const char *classname, const char *objname);
    3333
     34    enum { kIsOwner = BIT(14) };
     35
    3436public:
    3537    MParList(const char *name=NULL, const char *title=NULL);
    3638    MParList(MParList &ts);
    3739
    38     ~MParList()
    39     {
    40     }
     40    ~MParList();
    4141
    4242    Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
     
    5757    void SetReadyToSave(Bool_t flag=kTRUE);
    5858
     59    void SetOwner(Bool_t enable=kTRUE);
     60
    5961    void Print(Option_t *t = NULL);
    6062
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r887 r959  
    8080// --------------------------------------------------------------------------
    8181//
     82//  If the 'IsOwner' bit is set (via SetOwner()) all tasks are deleted
     83//  by the destructor
     84//
     85MTaskList::~MTaskList()
     86{
     87    if (TestBit(kIsOwner))
     88        fTasks.SetOwner();
     89}
     90
     91// --------------------------------------------------------------------------
     92//
     93//  If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted
     94//  by the destructor
     95//
     96inline void MTaskList::SetOwner(Bool_t enable=kTRUE)
     97{
     98    enable ? SetBit(kIsOwner) : ResetBit(kIsOwner);
     99}
     100
     101
     102// --------------------------------------------------------------------------
     103//
    82104//  Set the logging stream for the all tasks in the list and the tasklist
    83105//  itself.
     
    169191// --------------------------------------------------------------------------
    170192//
     193//  Find an object in the list.
     194//  'name' is the name of the object you are searching for.
     195//
     196TObject *MTaskList::FindObject(const char *name) const
     197{
     198    return fTasks.FindObject(name);
     199}
     200
     201// --------------------------------------------------------------------------
     202//
     203//  check if the object is in the list or not
     204//
     205TObject *MTaskList::FindObject(TObject *obj) const
     206{
     207    return fTasks.FindObject(obj);
     208}
     209
     210// --------------------------------------------------------------------------
     211//
    171212// do pre processing (before eventloop) of all tasks in the task-list
    172213//
     
    187228    // loop over all tasks for preproccesing
    188229    //
    189     while ( (task=(MTask*)Next()) )
     230    while ((task=(MTask*)Next()))
    190231    {
    191232        *fLog << task->GetName() << "... " << flush;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r860 r959  
    2727    MParList      *fParList;
    2828
     29    enum { kIsOwner = BIT(14) };
     30
    2931public:
    3032    MTaskList(const char *name=NULL, const char *title=NULL);
     33    MTaskList(MTaskList &ts);
    3134
    32     MTaskList(MTaskList &ts);
     35    ~MTaskList();
    3336
    3437    void SetLogStream(MLog *log);
    3538
    3639    Bool_t AddToList(MTask *task, const char *tType="All", MTask *where = NULL);
     40
     41    TObject *FindObject(const char *name) const;
     42    TObject *FindObject(TObject *obj) const;
    3743
    3844    Bool_t PreProcess(MParList *pList);
     
    4147
    4248    void Print(Option_t *opt = "");
     49    void SetOwner(Bool_t enable=kTRUE);
    4350
    4451    ClassDef(MTaskList, 0)      //collection of tasks to be performed in the eventloop
  • trunk/MagicSoft/Mars/mbase/Makefile

    r858 r959  
    4949           MLog.cc \
    5050           MHtml.cc \
     51           MClone.cc \
    5152           MLogManip.cc
    5253
Note: See TracChangeset for help on using the changeset viewer.