Changeset 9026


Ignore:
Timestamp:
07/21/08 09:18:18 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9024 r9026  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2008/07/21 Thomas Bretz
     22
     23   * mbase/MParContainer.[h,cc]:
     24     - adde new static ember functions GetClass
     25
     26   * mbase/MParList.[h,cc], mbase/MStatusArray.[h,cc],
     27     mreport/MReportHelp.cc:
     28     - use new GetClass function
     29
     30
    2031
    2132 2008/07/20 Thomas Bretz
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r9025 r9026  
    776776    // try to get class from root environment
    777777    //
    778     TClass *cls = GetClass(cname);
     778    gLog << err;
     779    TClass *cls = GetClass(cname, &gLog);
    779780    if (!cls)
    780781        return list;
     
    782783    if (!cls->InheritsFrom(MParContainer::Class()))
    783784    {
    784         *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "': " << endl;
    785         *fLog << "Class doesn't inherit from MParContainer." << endl;
     785        gLog << err << dbginf << "Cannot create new instance of class '" << cname << "': " << endl;
     786        gLog << "Class doesn't inherit from MParContainer." << endl;
    786787        return list;
    787788    }
  • trunk/MagicSoft/Mars/mbase/MStatusArray.cc

    r8961 r9026  
    4444#include "MStatusArray.h"
    4545
    46 #include <TH1.h>      // TH1::AddDirectoryStatus();
     46#include <TH1.h>       // TH1::AddDirectoryStatus();
    4747#include <TClass.h>
    4848#include <TCanvas.h>
     
    5151#include "MLogManip.h"
    5252
     53#include "MParContainer.h"   // MParContainer::GetClass
    5354#include "MStatusDisplay.h"
    5455
     
    125126}
    126127
    127 // FIXME: Move to a general class MMARS (TROOT) and unify with MParContainer
    128 TClass *MStatusArray::GetClass(const char *name) const
    129 {
    130     TClass *cls = gROOT->GetClass(name);
    131     Int_t rc = 0;
    132     if (!cls)
    133         rc =1;
    134     else
    135     {
    136         if (!cls->Property())
    137             rc = 5;
    138         if (!cls->Size())
    139             rc = 4;
    140         if (!cls->IsLoaded())
    141             rc = 3;
    142         if (!cls->HasDefaultConstructor())
    143             rc = 2;
    144     }
    145 
    146     if (rc==0)
    147         return cls;
    148 
    149     gLog << err << dbginf << "Class '" << name << "' not in dictionary: ";
    150     switch (rc)
    151     {
    152     case 1:
    153         gLog << "gROOT->GetClass() returned NULL." << endl;
    154         return NULL;
    155     case 2:
    156         gLog << "no default constructor." << endl;
    157         return NULL;
    158     case 3:
    159         gLog << "not loaded." << endl;
    160         return NULL;
    161     case 4:
    162         gLog << "zero size." << endl;
    163         return NULL;
    164     case 5:
    165         gLog << "no property." << endl;
    166         return NULL;
    167     }
    168 
    169     gLog << "THIS SHOULD NEVER HAPPEN!" << endl;
    170 
    171     return 0;
    172 }
    173 
    174128TCanvas *MStatusArray::FindCanvas(const char *name) const
    175129{
     
    184138TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *base, const char *canvas) const
    185139{
    186     TClass *cls = GetClass(base);
     140    gLog << err;
     141    TClass *cls = MParContainer::GetClass(base, &gLog);
    187142    if (!cls)
    188143        return 0;
  • trunk/MagicSoft/Mars/mbase/MStatusArray.h

    r8961 r9026  
    2424    void     PrintObjectsInPad(const TCollection *list, const TString &name, Int_t lvl=0) const;
    2525    TObject *FindObjectInPad(TVirtualPad *pad, const char *object, TClass *base) const;
    26     TClass  *GetClass(const char *name) const;
    2726
    2827public:
  • trunk/MagicSoft/Mars/mreport/MReportHelp.cc

    r4575 r9026  
    5858MReportHelp::MReportHelp(const char *name, MLog *fLog) : fReport(NULL), fNumReports(0), fNumSkipped(0)
    5959{
    60     TClass *cls = gROOT->GetClass(name);
    61     Int_t rc = 0;
    62     if (!cls)
    63         rc =1;
    64     else
    65     {
    66         if (!cls->Property())
    67             rc = 5;
    68         if (!cls->Size())
    69             rc = 4;
    70         if (!cls->IsLoaded())
    71             rc = 3;
    72         if (!cls->HasDefaultConstructor())
    73             rc = 2;
    74     }
    75 
    76     if (rc)
    77     {
    78         *fLog << err << dbginf << "Cannot create new instance of class '" << name << "': ";
    79         switch (rc)
    80         {
    81         case 1:
    82             *fLog << "gROOT->GetClass() returned NULL." << endl;
    83             return;
    84         case 2:
    85             *fLog << "no default constructor." << endl;
    86             return;
    87         case 3:
    88             *fLog << "not loaded." << endl;
    89             return;
    90         case 4:
    91             *fLog << "zero size." << endl;
    92             return;
    93         case 5:
    94             *fLog << "no property." << endl;
    95             return;
    96         }
    97     }
    98 
    9960    //
    10061    // create the parameter container of the the given class type
    10162    //
    102     fReport = (MReport*)cls->New();
     63    *fLog << err;
     64    TClass *cls = MParList::GetClass(name, fLog);
     65
     66    if (cls && cls->InheritsFrom(MReport::Class()))
     67        fReport = static_cast<MReport*>(cls->New());
    10368}
    10469
Note: See TracChangeset for help on using the changeset viewer.