Ignore:
Timestamp:
01/25/05 14:47:59 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r5307 r5994  
    100100MTask *MTaskEnv::GetTask(const char *name) const
    101101{
    102     //
    103     // try to get class from root environment
    104     //
    105     TClass *cls = gROOT->GetClass(name);
    106     Int_t rc = 0;
    107     if (!cls)
    108         rc =1;
    109     else
    110     {
    111         if (!cls->Property())
    112             rc = 5;
    113         if (!cls->Size())
    114             rc = 4;
    115         if (!cls->IsLoaded())
    116             rc = 3;
    117         if (!cls->HasDefaultConstructor())
    118             rc = 2;
    119     }
    120 
    121     if (rc)
    122     {
    123         *fLog << err << dbginf << "Cannot create new instance of class '" << name << "': ";
    124         switch (rc)
    125         {
    126         case 1:
    127             *fLog << "gROOT->GetClass() returned NULL." << endl;
    128             return NULL;
    129         case 2:
    130             *fLog << "no default constructor." << endl;
    131             return NULL;
    132         case 3:
    133             *fLog << "not loaded." << endl;
    134             return NULL;
    135         case 4:
    136             *fLog << "zero size." << endl;
    137             return NULL;
    138         case 5:
    139             *fLog << "no property." << endl;
    140             return NULL;
    141         }
    142     }
    143 
    144     if (!cls->InheritsFrom(MTask::Class()))
    145     {
    146         *fLog << " - Class doesn't inherit from MTask." << endl;
     102    MTask *task = (MTask*)GetNewObject(name, MTask::Class());
     103    if (!task)
    147104        return NULL;
    148     }
    149 
    150     //
    151     // create the parameter container of the the given class type
    152     //
    153     MTask *task = (MTask*)cls->New();
    154     if (!task)
    155     {
    156         *fLog << " - Class has no default constructor." << endl;
    157         *fLog << " - An abstract member functions of a base class is not overwritten." << endl;
    158         return NULL;
    159     }
    160105
    161106    task->SetName(fName);
Note: See TracChangeset for help on using the changeset viewer.