00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4TaskStatus.h"
00015
00016 #include "Riostream.h"
00017
00018 #include "TGo4TaskHandlerStatus.h"
00019
00020 TGo4TaskStatus::TGo4TaskStatus() :
00021 TGo4Status(),
00022 fxTaskHandlerStatus(0)
00023 {
00024 }
00025
00026 TGo4TaskStatus::TGo4TaskStatus(const char* name) :
00027 TGo4Status(name),
00028 fxTaskHandlerStatus(0)
00029 {
00030 }
00031
00032 TGo4TaskStatus::~TGo4TaskStatus()
00033 {
00034 delete fxTaskHandlerStatus;
00035 }
00036
00037 void TGo4TaskStatus::SetFlags(Bool_t blocking,
00038 Bool_t autocreate,
00039 Bool_t autostart,
00040 Bool_t terminating,
00041 Bool_t initdone)
00042 {
00043 fbAppBlocking=blocking;
00044 fbAutoCreate=autocreate;
00045 fbAutoStart=autostart;
00046 fbTerminating=terminating;
00047 fbInitDone=initdone;
00048 }
00049 void TGo4TaskStatus::SetTaskHandlerStatus(TGo4TaskHandlerStatus* thstate)
00050 {
00051 fxTaskHandlerStatus=thstate;
00052
00053 }
00054 Int_t TGo4TaskStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00055 {
00056
00057 if(buflen<=0 && buffer!=0)
00058 return 0;
00059 Int_t locallen=4096;
00060 Text_t localbuf[4096];
00061 Text_t* current=localbuf;
00062 Int_t size=0;
00063 Int_t restlen=locallen;
00064 current=PrintBuffer(current,restlen, "G-OOOO-> Client Status Class %s Printout: <-OOOO-G\n",GetName());
00065 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00066 current=PrintBuffer(current,restlen, "G-OOOO-> Blockingmode: %d\n",fbAppBlocking);
00067 current=PrintBuffer(current,restlen, "G-OOOO-> Autocreate: %d\n",fbAutoCreate);
00068 current=PrintBuffer(current,restlen, "G-OOOO-> Autostart: %d\n",fbAutoStart);
00069 current=PrintBuffer(current,restlen, "G-OOOO-> InitDone: %d\n",fbInitDone);
00070 current=PrintBuffer(current,restlen, "G-OOOO-> IsTerminating: %d\n",fbTerminating);
00071 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00072 Int_t delta=fxTaskHandlerStatus->PrintStatus(current,restlen);
00073 restlen-=delta;
00074 current+= delta;
00075 current=PrintBuffer(current,restlen, "G-OOOO-> END Client Status Class Printout END <-OOOO-G\n");
00076 if(buffer==0)
00077 {
00078 cout << localbuf << endl;
00079 }
00080 else
00081 {
00082 size=locallen-restlen;
00083 if(size>buflen-1)
00084 size=buflen-1;
00085 strncpy(buffer,localbuf,size);
00086 }
00087 return size;
00088 }