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