GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4TaskStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4TaskStatus.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 
14 #include "TGo4TaskStatus.h"
15 
16 #include <iostream>
17 
18 #include "TGo4TaskHandlerStatus.h"
19 
21  TGo4Status(),
22  fxTaskHandlerStatus(0)
23 {
24 }
25 
26 TGo4TaskStatus::TGo4TaskStatus(const char* name) :
27  TGo4Status(name),
28  fxTaskHandlerStatus(0)
29 {
30 }
31 
33 {
34  delete fxTaskHandlerStatus;
36 }
37 
38 void TGo4TaskStatus::SetFlags(Bool_t blocking,
39  Bool_t autocreate,
40  Bool_t autostart,
41  Bool_t terminating,
42  Bool_t initdone)
43 {
44  fbAppBlocking=blocking;
45  fbAutoCreate=autocreate;
46  fbAutoStart=autostart;
47  fbTerminating=terminating;
48  fbInitDone=initdone;
49 }
51 {
52  fxTaskHandlerStatus = thstate;
53 }
54 
55 Int_t TGo4TaskStatus::PrintStatus(Text_t* buffer, Int_t buflen)
56 {
57  //
58  if(buflen<=0 && buffer!=0) return 0;
59 
60  Int_t locallen=4096;
61  Text_t localbuf[4096];
62  Text_t* current=localbuf;
63  Int_t size = 0;
64  Int_t restlen = locallen;
65  current=PrintBuffer(current,restlen, "G-OOOO-> Client Status Class %s Printout: <-OOOO-G\n",GetName());
66  current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
67  current=PrintBuffer(current,restlen, "G-OOOO-> Blockingmode: %d\n",fbAppBlocking);
68  current=PrintBuffer(current,restlen, "G-OOOO-> Autocreate: %d\n",fbAutoCreate);
69  current=PrintBuffer(current,restlen, "G-OOOO-> Autostart: %d\n",fbAutoStart);
70  current=PrintBuffer(current,restlen, "G-OOOO-> InitDone: %d\n",fbInitDone);
71  current=PrintBuffer(current,restlen, "G-OOOO-> IsTerminating: %d\n",fbTerminating);
72  current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
73  Int_t delta=fxTaskHandlerStatus->PrintStatus(current,restlen);
74  restlen-=delta;
75  current+= delta;
76  current = PrintBuffer(current, restlen, "G-OOOO-> END Client Status Class Printout END <-OOOO-G\n");
77  if (buffer == 0) {
78  std::cout << localbuf << std::endl;
79  } else {
80  size = locallen - restlen;
81  if (size > buflen - 1)
82  size = buflen - 1;
83  strncpy(buffer, localbuf, size);
84  }
85  return size;
86 }
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
Bool_t fbAppBlocking
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
void SetTaskHandlerStatus(TGo4TaskHandlerStatus *thstate)
TGo4TaskHandlerStatus * fxTaskHandlerStatus
virtual ~TGo4TaskStatus()
void SetFlags(Bool_t blocking, Bool_t autocreate, Bool_t autostart, Bool_t terminating, Bool_t initdone)
Bool_t fbTerminating
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:84