00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4TaskHandlerStatus.h"
00015
00016 #include "Riostream.h"
00017
00018 #include "TGo4Log.h"
00019
00020 TGo4TaskHandlerStatus::TGo4TaskHandlerStatus() :
00021 TGo4Status(),
00022 fxComName(),
00023 fxStatName(),
00024 fxDatName(),
00025 fxHostName(),
00026 fuNegPort(0),
00027 fiComPort(0),
00028 fiStatPort(0),
00029 fiDatPort(0),
00030 fbIsAborting(kFALSE)
00031 {
00032 }
00033
00034 TGo4TaskHandlerStatus::TGo4TaskHandlerStatus(const char* name) :
00035 TGo4Status(name),
00036 fxComName(),
00037 fxStatName(),
00038 fxDatName(),
00039 fxHostName(),
00040 fuNegPort(0),
00041 fiComPort(0),
00042 fiStatPort(0),
00043 fiDatPort(0),
00044 fbIsAborting(kFALSE)
00045
00046 {
00047 }
00048
00049 TGo4TaskHandlerStatus::~TGo4TaskHandlerStatus()
00050 {
00051 }
00052
00053 Int_t TGo4TaskHandlerStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00054 {
00055 if(buflen<=0 && buffer!=0)
00056 return 0;
00057 Int_t locallen=4096;
00058 Text_t localbuf[4096];
00059 Text_t* current=localbuf;
00060 Int_t restlen=locallen;
00061 Int_t size=0;
00062 current=PrintBuffer(current,restlen, "G-OOOO-> TaskHandler Status Class %s Printout: <-OOOO-G\n",GetName());
00063 current=PrintBuffer(current,restlen, "G-OOOO-> --------------------------------------------------------------------- <-OOOO-G\n");
00064 current=PrintBuffer(current,restlen, "G-OOOO-> Remote Server: %s\n",GetHostName());
00065 current=PrintBuffer(current,restlen, "G-OOOO-> Negotiation Port: %d\n",fuNegPort);
00066 current=PrintBuffer(current,restlen, "G-OOOO-> Command Thread: %s\n",GetComName());
00067 current=PrintBuffer(current,restlen, "G-OOOO-> Command Port: %d\n",fiComPort);
00068 current=PrintBuffer(current,restlen, "G-OOOO-> Data Thread: %s\n",GetDatName());
00069 current=PrintBuffer(current,restlen, "G-OOOO-> Data Port: %d\n",fiDatPort);
00070 current=PrintBuffer(current,restlen, "G-OOOO-> Status Thread: %s\n",GetStatName());
00071 current=PrintBuffer(current,restlen, "G-OOOO-> Status Port: %d\n",fiStatPort);
00072 if(fbIsAborting)
00073 {
00074 current=PrintBuffer(current,restlen, "G-OOOO-> Aborting State: TRUE\n");
00075 }
00076 else
00077 {
00078 current=PrintBuffer(current,restlen, "G-OOOO-> Aborting State: FALSE\n");
00079 }
00080 current=PrintBuffer(current,restlen, "G-OOOO-> END TaskHandler Status Class Printout END <-OOOO-G\n");
00081 if(buffer==0)
00082 {
00083 std::cout << localbuf << std::endl;
00084 }
00085 else
00086 {
00087 size=locallen-restlen;
00088 if(size>buflen-1)
00089 size=buflen-1;
00090 strncpy(buffer,localbuf,size);
00091 }
00092 return size;
00093 }
00094
00095 void TGo4TaskHandlerStatus::SetFlags(Bool_t isaborting)
00096 {
00097 fbIsAborting=isaborting;
00098 }
00099
00100 void TGo4TaskHandlerStatus::SetPorts(UInt_t neg, Int_t com, Int_t stat, Int_t dat)
00101 {
00102 fuNegPort=neg;
00103 fiComPort=com;
00104 fiStatPort=stat;
00105 fiDatPort=dat;
00106 }
00107
00108 void TGo4TaskHandlerStatus::SetNames(const char* com, const char* stat, const char* dat, const char* host)
00109 {
00110 fxComName = com;
00111 fxStatName = stat;
00112 fxDatName = dat;
00113 fxHostName = host;
00114 }