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

/Go4StatusBase/TGo4ObjectStatus.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 "TGo4ObjectStatus.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TDatime.h"
00021 #include "TClass.h"
00022 
00023 #include "Go4Log/TGo4Log.h"
00024 
00025 TGo4ObjectStatus::TGo4ObjectStatus(TObject* object, Bool_t withtime)
00026 : TGo4Status("Initname","InitTitle"), fiObjectSize(0), fbResetProtect(kFALSE),fbDeleteProtect(kTRUE)
00027 {
00028    TRACE((15,"TGo4ObjectStatus::TGo4ObjectStatus(TNamed*)",__LINE__, __FILE__));
00029    if(object) {
00030       SetName(object->GetName());
00031       SetTitle(object->GetTitle());
00032       fxObjectClass=object->ClassName();
00033       fiObjectSize=object->IsA()->Size();
00034       fbDeleteProtect=   !object->TestBit(TGo4Status::kGo4CanDelete);
00035       fbResetProtect =   object->TestBit(TGo4Status::kGo4NoReset);
00036    } else {
00037       SetName("Unknown Name");
00038       SetTitle("Unknown Title");
00039       fxObjectClass="Unknown Class";
00040    }
00041    
00042    if(withtime) {
00043        TDatime now;
00044        fxStatusTime=now.AsSQLString();
00045    } else {
00046       //fxStatusTime="creation time unknown";
00047    }
00048 // we might suppress time information for substatus objects
00049 // for performance reason
00050 }
00051 
00052 Int_t TGo4ObjectStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00053 {
00054    TRACE((12,"TGo4ObjectStatus::PrintStatus()",__LINE__, __FILE__));
00055    if(buflen<=0 && buffer!=0)
00056       return 0;
00057    Int_t locallen=2048;
00058    Text_t localbuf[locallen];
00059    Text_t* current=localbuf;
00060    Int_t size=0;
00061    Int_t restlen=locallen;
00062    current=PrintIndent(current,restlen);
00063    current=PrintBuffer(current,restlen,"G-OOOO-> Object Status Class Printout <-OOOO-G\n");
00064    current=PrintIndent(current,restlen);
00065    current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00066    current=PrintIndent(current,restlen);
00067    current=PrintBuffer(current,restlen, " Object name: \t\t%s\n",GetName());
00068    current=PrintIndent(current,restlen);
00069    current=PrintBuffer(current,restlen, " Object title: \t\t%s\n",GetTitle());
00070    current=PrintIndent(current,restlen);
00071    current=PrintBuffer(current,restlen, " Object class: \t\t%s\n",GetObjectClass());
00072    current=PrintIndent(current,restlen);
00073    current=PrintBuffer(current,restlen, " Object size: \t\t%d byte\n",GetObjectSize());
00074    current=PrintIndent(current,restlen);
00075    current=PrintBuffer(current,restlen, " Clear protection: \t\t%d\n",IsResetProtect());
00076    current=PrintIndent(current,restlen);
00077    current=PrintBuffer(current,restlen, " Delete protection: \t\t%d\n",IsDeleteProtect());
00078    current=PrintIndent(current,restlen);
00079    current=PrintBuffer(current,restlen, " Status creation time: \t%s\n",GetTimeString());
00080    current=PrintIndent(current,restlen);
00081    current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00082    if(buffer==0)
00083       {
00084           cout << localbuf << endl;
00085       }
00086    else
00087       {
00088          size=locallen-restlen;
00089          if(size>buflen-1)
00090                size=buflen-1;
00091          strncpy(buffer,localbuf,size);
00092       }
00093    return size;
00094 }
00095 
00096 TGo4ObjectStatus::~TGo4ObjectStatus()
00097 {
00098 TRACE((15,"TGo4ObjectStatus::~TGo4ObjectStatus()",__LINE__, __FILE__));
00099 
00100 }
00101 
00102 ClassImp(TGo4ObjectStatus)
00103 
00104 
00105 
00106 
00107 
00108 //----------------------------END OF GO4 SOURCE FILE ---------------------

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