Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4ObjectStatus.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "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       //fxStatusTime="creation time unknown";
00062    }
00063 // we might suppress time information for substatus objects
00064 // for performance reason
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 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:28 2008 for Go4-v3.04-1 by  doxygen 1.4.2