GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4TaskHandlerStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4TaskHandlerStatus.cxx 934 2013-01-29 15:59:24Z 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 für 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 "TGo4TaskHandlerStatus.h"
15 
16 #include "Riostream.h"
17 
18 #include "TGo4Log.h"
19 
21  TGo4Status(),
22  fxComName(),
23  fxStatName(),
24  fxDatName(),
25  fxHostName(),
26  fuNegPort(0),
27  fiComPort(0),
28  fiStatPort(0),
29  fiDatPort(0),
30  fbIsAborting(kFALSE)
31 {
32 }
33 
35  TGo4Status(name),
36  fxComName(),
37  fxStatName(),
38  fxDatName(),
39  fxHostName(),
40  fuNegPort(0),
41  fiComPort(0),
42  fiStatPort(0),
43  fiDatPort(0),
44  fbIsAborting(kFALSE)
45 
46 {
47 }
48 
50 {
51 }
52 
53 Int_t TGo4TaskHandlerStatus::PrintStatus(Text_t* buffer, Int_t buflen)
54 {
55  if(buflen<=0 && buffer!=0)
56  return 0;
57  Int_t locallen=4096;
58  Text_t localbuf[4096];
59  Text_t* current=localbuf;
60  Int_t restlen=locallen;
61  Int_t size=0;
62  current=PrintBuffer(current,restlen, "G-OOOO-> TaskHandler Status Class %s Printout: <-OOOO-G\n",GetName());
63  current=PrintBuffer(current,restlen, "G-OOOO-> --------------------------------------------------------------------- <-OOOO-G\n");
64  current=PrintBuffer(current,restlen, "G-OOOO-> Remote Server: %s\n",GetHostName());
65  current=PrintBuffer(current,restlen, "G-OOOO-> Negotiation Port: %d\n",fuNegPort);
66  current=PrintBuffer(current,restlen, "G-OOOO-> Command Thread: %s\n",GetComName());
67  current=PrintBuffer(current,restlen, "G-OOOO-> Command Port: %d\n",fiComPort);
68  current=PrintBuffer(current,restlen, "G-OOOO-> Data Thread: %s\n",GetDatName());
69  current=PrintBuffer(current,restlen, "G-OOOO-> Data Port: %d\n",fiDatPort);
70  current=PrintBuffer(current,restlen, "G-OOOO-> Status Thread: %s\n",GetStatName());
71  current=PrintBuffer(current,restlen, "G-OOOO-> Status Port: %d\n",fiStatPort);
72  if(fbIsAborting)
73  {
74  current=PrintBuffer(current,restlen, "G-OOOO-> Aborting State: TRUE\n");
75  }
76  else
77  {
78  current=PrintBuffer(current,restlen, "G-OOOO-> Aborting State: FALSE\n");
79  }
80  current=PrintBuffer(current,restlen, "G-OOOO-> END TaskHandler Status Class Printout END <-OOOO-G\n");
81  if(buffer==0)
82  {
83  std::cout << localbuf << std::endl;
84  }
85  else
86  {
87  size=locallen-restlen;
88  if(size>buflen-1)
89  size=buflen-1;
90  strncpy(buffer,localbuf,size);
91  }
92  return size;
93 }
94 
95 void TGo4TaskHandlerStatus::SetFlags(Bool_t isaborting)
96 {
97  fbIsAborting=isaborting;
98 }
99 
100 void TGo4TaskHandlerStatus::SetPorts(UInt_t neg, Int_t com, Int_t stat, Int_t dat)
101 {
102  fuNegPort=neg;
103  fiComPort=com;
104  fiStatPort=stat;
105  fiDatPort=dat;
106 }
107 
108 void TGo4TaskHandlerStatus::SetNames(const char* com, const char* stat, const char* dat, const char* host)
109 {
110  fxComName = com;
111  fxStatName = stat;
112  fxDatName = dat;
113  fxHostName = host;
114 }
void SetPorts(UInt_t neg, Int_t com, Int_t stat, Int_t dat)
const char * GetDatName() const
const char * GetComName() const
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
const char * GetHostName() const
void SetFlags(Bool_t isaborting)
const char * GetStatName() const
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:85
void SetNames(const char *com, const char *stat, const char *dat, const char *host)