GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ObjectStatus.cxx
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4ObjectStatus.h"
15 
16 #include "TDatime.h"
17 #include "TClass.h"
18 
19 #include "TGo4Log.h"
20 #include "TGo4Picture.h"
21 
23  TGo4Status()
24 {
25 }
26 
27 TGo4ObjectStatus::TGo4ObjectStatus(TObject *object, Bool_t withtime) :
28  TGo4Status("Initname","InitTitle")
29 {
30  GO4TRACE((15,"TGo4ObjectStatus::TGo4ObjectStatus(TNamed*)",__LINE__, __FILE__));
31  if(object) {
32  SetName(object->GetName());
33  SetTitle(object->GetTitle());
34  fxObjectClass = object->ClassName();
35  fiObjectSize = object->IsA()->Size();
36  if (object->InheritsFrom(TGo4Picture::Class()))
37  fiObjectSize = ((TGo4Picture *) object)->GetTotalSize();
38  fbDeleteProtect = !object->TestBit(TGo4Status::kGo4CanDelete);
39  fbResetProtect = object->TestBit(TGo4Status::kGo4NoReset);
40  } else {
41  SetName("Unknown Name");
42  SetTitle("Unknown Title");
43  fxObjectClass = "Unknown Class";
44  }
45 
46  if (withtime) {
47  TDatime now;
48  fxStatusTime = now.AsSQLString();
49  }
50  // we might suppress time information for substatus objects
51  // for performance reason
52 }
53 
55 {
56  GO4TRACE((15,"TGo4ObjectStatus::~TGo4ObjectStatus()",__LINE__, __FILE__));
57 
58 }
59 
60 void TGo4ObjectStatus::Print(Option_t *) const
61 {
62  PrintLine("G-OOOO-> Object Status Class Printout <-OOOO-G");
63  PrintLine("G-OOOO-> ---------------------------------------------- <-OOOO-G");
64  PrintLine(" Object name: \t\t%s", GetName());
65  PrintLine(" Object title: \t\t%s", GetTitle());
66  PrintLine(" Object class: \t\t%s", GetObjectClass());
67  PrintLine(" Object size: \t\t%d byte", GetObjectSize());
68  PrintLine(" Clear protection: \t\t%d", IsResetProtect());
69  PrintLine(" Delete protection: \t\t%d", IsDeleteProtect());
70  PrintLine(" Status creation time: \t%s", GetTimeString());
71  PrintLine("G-OOOO-> ---------------------------------------------- <-OOOO-G");
72 }
Bool_t IsResetProtect() const
Bool_t IsDeleteProtect() const
const char * GetObjectClass() const
Int_t GetObjectSize() const
const char * GetTimeString() const
void Print(Option_t *opt="") const override
#define GO4TRACE(X)
Definition: TGo4Log.h:25
static void PrintLine(const char *text,...)
Definition: TGo4Status.cxx:101
virtual ~TGo4ObjectStatus()