GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ExampleClientStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4ExampleClientStatus.cxx 2770 2020-04-16 15:02:30Z linev $
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 
15 
16 #include <iostream>
17 
18 #include "TH1.h"
19 
20 #include "TGo4Log.h"
21 
23 {
24  GO4TRACE((12,"TGo4ExampleClientStatus::TGo4ExampleClientStatus(const char*)",__LINE__, __FILE__));
25 }
26 
28 {
29  GO4TRACE((12,"TGo4ClientStatus::SetHistoStatus(TH1*)",__LINE__, __FILE__));
30  fxHistogramName = histogram->GetName();
31  // here the complete internal histogram information may be stored; we leave that
32  // as an exercise for the reader!
33 }
34 
35 void TGo4ExampleClientStatus::SetNames(const char* main, const char* watch)
36 {
37  GO4TRACE((12,"TGo4ClientStatus::SetNames(const char*,...)",__LINE__, __FILE__));
38  fxMainName = main;
39  fxWatchName = watch;
40 }
41 
42 Int_t TGo4ExampleClientStatus::PrintStatus(Text_t* buffer, Int_t buflen)
43 {
44  GO4TRACE((12,"TGo4ExampleClientStatus::PrintStatus()",__LINE__, __FILE__));
45  //
46  if(buflen<=0 && buffer!=0)return 0;
47  Int_t locallen=4096;
48  Text_t localbuf[4096];
49  Text_t* current=localbuf;
50  Int_t size=0;
51  Int_t restlen=locallen;
52 
53  current=PrintBuffer(current,restlen, "G-OOOO-> ExampleClient Status Class %s Printout: <-OOOO-G\n",GetName());
54  current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
55  current=PrintBuffer(current,restlen, "G-OOOO-> Main Runnable Name: %s\n",fxMainName.Data());
56  current=PrintBuffer(current,restlen, "G-OOOO-> Watch Runnable Name: %s\n",fxWatchName.Data());
57  current=PrintBuffer(current,restlen, "G-OOOO-> Demo Histogram Name: %s\n",fxHistogramName.Data());
58  current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
59  Int_t delta=TGo4ClientStatus::PrintStatus(current,restlen); // gives us the superclass data
60  restlen-=delta;
61  current+=delta;
62  current = PrintBuffer(current, restlen, "G-OOOO-> END Example Client Status Class Printout END <-OOOO-G\n");
63  if (buffer == 0) {
64  std::cout << localbuf << std::endl;
65  } else {
66  size = locallen - restlen;
67  if (size > buflen - 1)
68  size = buflen - 1;
69  strncpy(buffer, localbuf, size);
70  }
71  return size;
72 }
73 
75 {
76  GO4TRACE((12,"TGo4ExampleClientStatus::~TGo4ExampleClientStatus()",__LINE__, __FILE__));
77 }
int main(int argc, char **argv)
void SetHistoStatus(TH1 *histogram)
void SetNames(const char *main, const char *watch)
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:84
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)