Ignore:
Timestamp:
08/02/02 15:20:53 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
8 edited

Legend:

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

    r1476 r1477  
    8080    fTitle = rhs.fTitle;
    8181
    82     fLog         = rhs.fLog;
     82    fLog = rhs.fLog;
    8383    fReadyToSave = rhs.fReadyToSave;
    8484
     
    123123    cont.fTitle = fTitle;
    124124
    125     cont.fLog         = fLog;
     125    cont.fLog = fLog;
    126126    cont.fReadyToSave = fReadyToSave;
    127127}
     
    168168{
    169169    fName = name;
     170    ResetBit(kIsSavedAsPrimitive);
    170171    if (gPad && TestBit(kMustCleanup)) gPad->Modified();
    171172}
     
    180181    fName  = name;
    181182    fTitle = title;
     183    ResetBit(kIsSavedAsPrimitive);
    182184    if (gPad && TestBit(kMustCleanup)) gPad->Modified();
    183185}
     
    190192{
    191193    fTitle = title;
     194    ResetBit(kIsSavedAsPrimitive);
    192195    if (gPad && TestBit(kMustCleanup)) gPad->Modified();
    193196}
     
    356359void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
    357360{
    358     out << "   // SavePrimitive not overloaded... using default." << endl;
     361    if (IsSavedAsPrimitive())
     362        return;
     363
     364    StreamPrimitive(out);
     365    SetBit(kIsSavedAsPrimitive);
     366}
     367
     368// --------------------------------------------------------------------------
     369//
     370// Creates the string written by SavePrimitive and returns it.
     371//
     372void MParContainer::StreamPrimitive(ofstream &out) const
     373{
     374    out << "   // Using MParContainer::StreamPrimitive" << endl;
    359375    out << "   " << ClassName() << " " << ToLower(fName) << "(\"";
    360376    out << fName << "\", \"" << fTitle << "\");" << endl;
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r1474 r1477  
    3434    MLog   *fLog;         // The general log facility for this object, initialized with the global object
    3535
     36    virtual void StreamPrimitive(ofstream &out) const;
     37
    3638private:
    3739    Bool_t  fReadyToSave; // should be set to true if the contents of the container is changed somehow
     40
     41    enum {
     42        kIsSavedAsPrimitive = BIT(15)
     43    };
    3844
    3945public:
     
    6773    virtual Bool_t IsReadyToSave() const             { return fReadyToSave; }
    6874    virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
     75    virtual Bool_t IsSavedAsPrimitive() const        { return TestBit(kIsSavedAsPrimitive); }
    6976
    7077    TMethodCall *GetterMethod(const char *name) const;
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1476 r1477  
    666666// gui elements to a macro-file.
    667667//
    668 void MParList::SavePrimitive(ofstream &out, Option_t *o)
     668void MParList::StreamPrimitive(ofstream &out) const
    669669{
    670670    out << "   MParList " << ToLower(fName) << "(\"";
     
    677677    {
    678678        cont->SavePrimitive(out, "");
     679
    679680        out << "   " << ToLower(fName) << ".AddToList(&";
    680681        out << ToLower(cont->GetName()) << ");" << endl << endl;
     
    691692{
    692693    MParContainer::SetNames(arr);
    693     cout << fContainer << endl;
    694     //    fContainer->ForEach(MParContainer, SetNames)(arr);
    695     TIter Next(fContainer);
    696 
    697     MParContainer *cont = NULL;
    698     while ((cont=(MParContainer*)Next()))
    699     {
    700         cout << cont << " " << cont->GetName() << endl;
    701         cont->SetNames(arr);
    702     }
    703 
    704 }
    705 
     694    fContainer->ForEach(MParContainer, SetNames)(arr);
     695}
     696
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r1474 r1477  
    3232
    3333    enum { kIsOwner = BIT(14) };
     34
     35    void StreamPrimitive(ofstream &out) const;
    3436
    3537public:
     
    7880
    7981    void Print(Option_t *t = NULL) const;
    80     void SavePrimitive(ofstream &out, Option_t *o="");
    8182
    8283    void GetNames(TObjArray &arr) const;
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r1476 r1477  
    265265// --------------------------------------------------------------------------
    266266//
    267 // Implementation of SavePrimitive. Used to write the call to a constructor
    268 // to a macro. In the original root implementation it is used to write
    269 // gui elements to a macro-file.
    270 //
    271 void MTask::SavePrimitive(ofstream &out, Option_t *o)
     267// First call MParContainer::SavePrimitive which should stream the primitive
     268// to the output stream. Then, if a filter is set, stream first the filter
     269// and afterwards set the filter for this task.
     270//
     271void MTask::SavePrimitive(ofstream &out, Option_t *o="")
    272272{
    273273    MParContainer::SavePrimitive(out);
    274     if (fFilter)
    275         out << "   " << ToLower(fName) << ".SetFilter(&" << ToLower(fFilter->GetName()) <<");" << endl;
    276 }
     274    if (!fFilter)
     275        return;
     276
     277    /*
     278     If we don't stream filter which are not in the task list itself
     279     (which means: alrteady streamed) we may be able to use the
     280     primitive streamer as some kind of validity check for the macros
     281
     282     fFilter->SavePrimitive(out);
     283     out << "   " << ToLower(fName) << ".SetFilter(&" << ToLower(fFilter->GetName()) <<");" << endl;
     284     */
     285}
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r1474 r1477  
    2222{
    2323private:
    24     TList *fListOfBranches; // List of Branch names for auto enabeling scheme
     24    TList *fListOfBranches; //! List of Branch names for auto enabeling scheme
    2525
    2626    const MFilter *fFilter; // Filter for conditional task execution
    2727
    28     Bool_t fIsPreprocessed; // Indicates the success of the PreProcessing (set by MTaskList)
    29     UInt_t fNumExecutions;  // Number of Excutions
     28    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
     29    UInt_t fNumExecutions;  //! Number of Excutions
    3030
    3131    virtual Bool_t PreProcess(MParList *pList);
     
    7171    const MFilter *GetFilter() const      { return fFilter; }
    7272    virtual void PrintStatistics(const Int_t lvl=0) const;
    73     virtual void SavePrimitive(ofstream &out, Option_t *o="");
    7473
    7574    UInt_t GetNumExecutions() { return fNumExecutions; }
     
    8382    const TList *GetListOfBranches() const { return fListOfBranches; }
    8483
    85     ClassDef(MTask, 0) //Abstract base class for a task
     84    void SavePrimitive(ofstream &out, Option_t *o="");
     85
     86    ClassDef(MTask, 1) //Abstract base class for a task
    8687};
    8788
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1476 r1477  
    520520// gui elements to a macro-file.
    521521//
    522 void MTaskList::SavePrimitive(ofstream &out, Option_t *o)
     522void MTaskList::StreamPrimitive(ofstream &out) const
    523523{
    524524    out << "   MTaskList " << ToLower(fName) << "(\"";
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r1474 r1477  
    3333    Bool_t CheckClassForProcess(TClass *cls);
    3434
     35    void StreamPrimitive(ofstream &out) const;
     36
    3537public:
    3638    MTaskList(const char *name=NULL, const char *title=NULL);
     
    5658    void SetOwner(Bool_t enable=kTRUE);
    5759
    58     void SavePrimitive(ofstream &out, Option_t *o="");
    59 
    6060    const TList *GetList() const { return fTasks; }
    6161
Note: See TracChangeset for help on using the changeset viewer.