Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4StatusAnalysis/TGo4AnalysisObjectNames.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4AnalysisObjectNames.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TROOT.h"
00021 
00022 #include "Go4Log/TGo4Log.h"
00023 
00024 TGo4AnalysisObjectNames::TGo4AnalysisObjectNames(const char* name)
00025 : TGo4Status(name), fxTopFolder(0)
00026 {
00027   TRACE((15,"TGo4AnalysisObjectnames::TGo4AnalysisObjectnames(Text_t*)",__LINE__, __FILE__));
00028 }
00029 
00030 TGo4AnalysisObjectNames::~TGo4AnalysisObjectNames()
00031 {
00032 TRACE((15,"TGo4AnalysisObjectnames::~TGo4AnalysisObjectnames()",__LINE__, __FILE__));
00033 if(fxTopFolder!=0)
00034    {
00035       delete fxTopFolder;
00036       fxTopFolder=0;
00037    }
00038 }
00039 
00040 Int_t TGo4AnalysisObjectNames::PrintStatus(Text_t* buffer, Int_t buflen)
00041 {
00042    TRACE((12,"TGo4AnalysisObjectNames::PrintStatus()",__LINE__, __FILE__));
00043    //
00044    if(buflen<=0 && buffer!=0)
00045       return 0;
00046    gROOT->SetDirLevel(0);
00047    Int_t locallen=64000;
00048    Text_t localbuf[locallen];
00049    Int_t size=0;
00050    Text_t* current=localbuf;
00051    Int_t restlen=locallen;
00052    current=PrintBuffer(localbuf,restlen,"G-OOOO-> Analysis Object Names Printout <-OOOO-G\n");
00053    current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00054    Int_t delta=PrintFolder(fxTopFolder, current, restlen);
00055    restlen-=delta;
00056    current+= delta;
00057    if(buffer==0)
00058       {
00059           cout << localbuf << endl;
00060       }
00061    else
00062       {
00063          size=locallen-restlen;
00064          if(size>buflen-1)
00065             size=buflen-1;
00066          strncpy(buffer,localbuf,size);
00067       }
00068    return size;
00069 }
00070 
00071 Int_t TGo4AnalysisObjectNames::PrintFolder(TFolder* fold, Text_t * buf, Int_t buflen)
00072 {
00073    TRACE((12,"TGo4AnalysisObjectNames::PrintFolder()",__LINE__, __FILE__));
00074    //
00075    if(buf!=0 && buflen<=0)
00076       {
00077          cout <<"PrintFolder returns nop" << endl;
00078          return 0;
00079       }
00080    gROOT->IncreaseDirLevel();
00081    Int_t locallen=64000;
00082    Text_t localbuf[locallen];
00083    Int_t size=0;
00084    TCollection* objectlist=0;
00085    TIterator* listiter=0;
00086    TObject* entry=0;
00087    Text_t* current=localbuf;
00088    Int_t restlen=locallen;
00089    if(fold)
00090       {
00091          current=PrintIndent(current,restlen);
00092          current=PrintBuffer(current,restlen,"G-OOOO-> Status Folder %s Printout <-OOOO-G\n", fold->GetName());
00093          current=PrintIndent(current,restlen);
00094          current=PrintBuffer(current,restlen,"G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00095          //objectlist=dynamic_cast<TList*> (fold->GetListOfFolders());
00096          objectlist=fold->GetListOfFolders();
00097          listiter=objectlist->MakeIterator();
00098          //cout << "----------- processing Print Folder "<< endl;
00099 
00100          while((entry=listiter->Next()) !=0)
00101             {
00102                if(entry->InheritsFrom("TFolder"))
00103                   {
00104                       // found subfolder, process in recursion
00105                       TFolder* subobj= dynamic_cast<TFolder*> (entry);
00106                       Int_t delta=PrintFolder(subobj, current, restlen);
00107                       restlen-=delta;
00108                       current+= delta;
00109                   }
00110                else if (entry->InheritsFrom("TGo4Status"))
00111                   {
00112                      TGo4Status* subobj= dynamic_cast<TGo4Status*> (entry);
00113                      Int_t delta=subobj->PrintStatus(current,restlen);
00114                      restlen-=delta;
00115                      current+=delta;
00116                   }
00117                else
00118                 {
00119                      entry->ls();
00120                   // unknown object
00121                 }
00122             } // while
00123       current=PrintIndent(current,restlen);
00124       current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00125       delete listiter;
00126       }
00127    else
00128       {
00129 
00130       } // if(folder)
00131    if(buf==0)
00132       {
00133           cout << localbuf << endl;
00134       }
00135    else
00136       {
00137          size=locallen-restlen;
00138          if(size>buflen-1)
00139                size=buflen-1;
00140          strncpy(buf,localbuf,size);
00141 
00142       }
00143    gROOT->DecreaseDirLevel();
00144    return size;
00145 }
00146 
00147 ClassImp(TGo4AnalysisObjectNames)
00148 
00149 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:05 2005 for Go4-v2.10-5 by doxygen1.2.15