00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4ObjectStatus.h"
00017
00018 #include "Riostream.h"
00019
00020 #include "TDatime.h"
00021 #include "TClass.h"
00022
00023 #include "TGo4Log.h"
00024
00025 TGo4ObjectStatus::TGo4ObjectStatus() :
00026 TGo4Status(),
00027 fiObjectSize(0),
00028 fbResetProtect(kFALSE),
00029 fbDeleteProtect(kTRUE),
00030 fxObjectClass(),
00031 fxStatusTime()
00032 {
00033 }
00034
00035 TGo4ObjectStatus::TGo4ObjectStatus(TObject* object, Bool_t withtime) :
00036 TGo4Status("Initname","InitTitle"),
00037 fiObjectSize(0),
00038 fbResetProtect(kFALSE),
00039 fbDeleteProtect(kTRUE),
00040 fxObjectClass(),
00041 fxStatusTime()
00042 {
00043 TRACE((15,"TGo4ObjectStatus::TGo4ObjectStatus(TNamed*)",__LINE__, __FILE__));
00044 if(object) {
00045 SetName(object->GetName());
00046 SetTitle(object->GetTitle());
00047 fxObjectClass=object->ClassName();
00048 fiObjectSize=object->IsA()->Size();
00049 fbDeleteProtect= !object->TestBit(TGo4Status::kGo4CanDelete);
00050 fbResetProtect = object->TestBit(TGo4Status::kGo4NoReset);
00051 } else {
00052 SetName("Unknown Name");
00053 SetTitle("Unknown Title");
00054 fxObjectClass="Unknown Class";
00055 }
00056
00057 if(withtime) {
00058 TDatime now;
00059 fxStatusTime=now.AsSQLString();
00060 } else {
00061
00062 }
00063
00064
00065 }
00066
00067 TGo4ObjectStatus::~TGo4ObjectStatus()
00068 {
00069 TRACE((15,"TGo4ObjectStatus::~TGo4ObjectStatus()",__LINE__, __FILE__));
00070
00071 }
00072
00073 Int_t TGo4ObjectStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00074 {
00075 TRACE((12,"TGo4ObjectStatus::PrintStatus()",__LINE__, __FILE__));
00076 if(buflen<=0 && buffer!=0)
00077 return 0;
00078 Int_t locallen=2048;
00079 Text_t localbuf[2048];
00080 Text_t* current=localbuf;
00081 Int_t size=0;
00082 Int_t restlen=locallen;
00083 current=PrintIndent(current,restlen);
00084 current=PrintBuffer(current,restlen,"G-OOOO-> Object Status Class Printout <-OOOO-G\n");
00085 current=PrintIndent(current,restlen);
00086 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00087 current=PrintIndent(current,restlen);
00088 current=PrintBuffer(current,restlen, " Object name: \t\t%s\n",GetName());
00089 current=PrintIndent(current,restlen);
00090 current=PrintBuffer(current,restlen, " Object title: \t\t%s\n",GetTitle());
00091 current=PrintIndent(current,restlen);
00092 current=PrintBuffer(current,restlen, " Object class: \t\t%s\n",GetObjectClass());
00093 current=PrintIndent(current,restlen);
00094 current=PrintBuffer(current,restlen, " Object size: \t\t%d byte\n",GetObjectSize());
00095 current=PrintIndent(current,restlen);
00096 current=PrintBuffer(current,restlen, " Clear protection: \t\t%d\n",IsResetProtect());
00097 current=PrintIndent(current,restlen);
00098 current=PrintBuffer(current,restlen, " Delete protection: \t\t%d\n",IsDeleteProtect());
00099 current=PrintIndent(current,restlen);
00100 current=PrintBuffer(current,restlen, " Status creation time: \t%s\n",GetTimeString());
00101 current=PrintIndent(current,restlen);
00102 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00103 if(buffer==0)
00104 {
00105 cout << localbuf << endl;
00106 }
00107 else
00108 {
00109 size=locallen-restlen;
00110 if(size>buflen-1)
00111 size=buflen-1;
00112 strncpy(buffer,localbuf,size);
00113 }
00114 return size;
00115 }
00116
00117