00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4EventStatus.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TClass.h"
00021 #include "TDataMember.h"
00022 #include "TBaseClass.h"
00023
00024 #include "Go4Log/TGo4Log.h"
00025 #include "Go4Event/TGo4EventElement.h"
00026 #include "Go4StatusBase/TGo4MemberStatus.h"
00027
00028 TGo4EventStatus::TGo4EventStatus(TGo4EventElement* ev) : TGo4ObjectStatus(ev,kFALSE)
00029 {
00030 fxTempFolder = gROOT->GetRootFolder()->AddFolder("temp","Eventstatus temporary object folder");
00031 fxTempFolder->SetOwner(kFALSE);
00032 TClass* eclass = ev->IsA();
00033 fxFolder = CreateMembersFolder(eclass);
00034 }
00035
00036 TGo4EventStatus::TGo4EventStatus() : TGo4ObjectStatus()
00037 {
00038 }
00039
00040 TGo4EventStatus::~TGo4EventStatus()
00041 {
00042 gROOT->GetRootFolder()->Remove(fxTempFolder);
00043 fxTempFolder->Clear();
00044 delete fxTempFolder;
00045 }
00046
00047
00048 Int_t TGo4EventStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00049 {
00050 TRACE((12,"TGo4EventStatus::PrintStatus()",__LINE__, __FILE__));
00051 if(buflen<=0 && buffer!=0)
00052 return 0;
00053 Int_t locallen=128000;
00054 Text_t localbuf[locallen];
00055 Int_t size=0;
00056 Text_t* current=localbuf;
00057 Int_t restlen=locallen;
00058 Int_t delta = TGo4ObjectStatus::PrintStatus(current,restlen);
00059 restlen-=delta;
00060 current+=delta;
00061 current=PrintIndent(current,restlen);
00062 current=PrintBuffer(current,restlen, "G-OOOO-> Event Status Class Printout <-OOOO-G\n");
00063 current=PrintIndent(current,restlen);
00064 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00065
00066 if(fxFolder) {
00067 TIter iter(fxFolder->GetListOfFolders());
00068 TObject* nob = 0;
00069 while((nob = iter()) !=0)
00070 {
00071 TGo4MemberStatus* memstat= dynamic_cast<TGo4MemberStatus*>(nob);
00072 if(memstat)
00073 {
00074 delta=memstat->PrintStatus(current,restlen);
00075 restlen-=delta;
00076 current+=delta;
00077 }
00078 }
00079 }
00081
00082 {
00083 cout << localbuf << endl;
00084 }
00085 else
00086 {
00087 size=locallen-restlen;
00088 if(size>buflen-1)
00089 size=buflen-1;
00090 strncpy(buffer,localbuf,size);
00091 }
00092 return size;
00093 }
00094
00095
00096 TFolder* TGo4EventStatus::CreateMembersFolder(TClass* cl)
00097 {
00098 if(cl==0) return 0;
00099 TFolder* memberfolder;
00100 TList* nameslist= new TList;
00101 TList* members =cl->GetListOfDataMembers();
00102 TIterator* memiter=members->MakeIterator();
00103 TObject* nob=0;
00104 TGo4MemberStatus* state;
00105
00106 while((nob=memiter->Next()) !=0)
00107 {
00108 TDataMember* mem=dynamic_cast<TDataMember*>(nob);
00109 if(mem->IsaPointer()) continue;
00110
00111 state=new TGo4MemberStatus(mem);
00112 nameslist->AddLast(state);
00113 }
00114 delete memiter;
00115
00116 TList* baselist=cl->GetListOfBases();
00117 TIterator* baseiter=baselist->MakeIterator();
00118 TObject* bob=0;
00119 while((bob=baseiter->Next()) !=0)
00120 {
00121 TBaseClass* baseclass=dynamic_cast<TBaseClass*>(bob);
00122 if(baseclass)
00123 {
00124
00125 TClass* bclass=baseclass->GetClassPointer();
00126 if(bclass==0) continue;
00127 if(!strcmp(bclass->GetName(),"TNamed")) continue;
00128
00129 TFolder* subfold=CreateMembersFolder(bclass);
00130 if(subfold==0) continue;
00131
00132
00133
00134 subfold->SetName(bclass->GetName());
00135 nameslist->AddLast(subfold);
00136 }
00137 }
00138 delete baseiter;
00139 memberfolder=fxTempFolder->AddFolder(GetName(),GetTitle(),nameslist);
00140 fxTempFolder->Remove(memberfolder);
00141 memberfolder->SetOwner(kTRUE);
00142 return memberfolder;
00143 }
00144
00145
00146
00147 ClassImp(TGo4EventStatus)
00148
00149
00150
00151
00152