Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4StatusBase/TGo4Status.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4Status.h"
00017 
00018 #include <stdarg.h>
00019 #include <iostream.h>
00020 
00021 #include "TROOT.h"
00022 
00023 #include "Go4Log/TGo4Log.h"
00024 
00025 TGo4Status::TGo4Status(){}
00026 
00027 TGo4Status::TGo4Status(const char* name) : TNamed(name, "This is a Go4 Status Object")
00028 {
00029    TRACE((12,"TGo4Status::TGo4Status(Text_t*)",__LINE__, __FILE__));
00030 }
00031 
00032 TGo4Status::TGo4Status(const char* name, const char* title) : TNamed(name, title)
00033 {
00034    TRACE((12,"TGo4Status::TGo4Status(Text_t*, Text_t*)",__LINE__, __FILE__));
00035 }
00036 
00037 
00038 TGo4Status::~TGo4Status()
00039 {
00040    TRACE((12,"TGo4Status::~TGo4Status()",__LINE__, __FILE__));
00041 }
00042 
00043 void TGo4Status::Print(Option_t* dummy) const
00044 {
00045    // this trick is needed since root defines Print as const function...
00046    TGo4Status* const localthis= const_cast<TGo4Status* const>(this);
00047    localthis->PrintStatus();
00048 }
00049 
00050 Int_t TGo4Status::PrintStatus(Text_t* buffer, Int_t buflen)
00051 {
00052    TRACE((12,"TGo4Status::PrintStatus()",__LINE__, __FILE__));
00053    //
00054    if(buflen<=0 && buffer!=0)
00055       return 0;
00056    Int_t locallen=2048;
00057    Text_t localbuf[locallen];
00058    Int_t size=0;
00059    size=snprintf(localbuf, locallen-1,
00060                      "G-OOOO-> Status Class %s, name: %s <-OOOO-G\n",
00061                         ClassName(), GetName());
00062    if(buffer==0)
00063       {
00064           cout << localbuf << endl;
00065       }
00066    else
00067       {
00068          if(size>buflen-1)
00069             size=buflen-1;
00070          strncpy(buffer,localbuf,size);
00071       }
00072    return size;
00073 }
00074 
00075 Text_t* TGo4Status::PrintIndent(Text_t* buffer, Int_t& buflen)
00076 {
00077    if(buflen<0 && buffer!=0) return 0;   
00078    Int_t restlen=buflen;
00079    Text_t* cursor=buffer;
00080    for (int i = 0; (i < TROOT::GetDirLevel()) && (i< buflen); i++)
00081       {
00082          cursor=PrintBuffer(cursor,restlen," ");
00083       }  
00084    buflen=restlen;
00085    return cursor;   
00086 }
00087 
00088 Text_t* TGo4Status::PrintBuffer(Text_t* buffer, Int_t& buflen, const Text_t* text,...)
00089 {
00090    if(buffer==0 || buflen<0) return 0;
00091    va_list args;
00092    va_start(args, text);
00093    Int_t size=vsnprintf(buffer, buflen, text, args);
00094    va_end(args);
00095    if(size>buflen || size<0) return 0;
00096    Text_t* current= buffer + size;
00097    buflen-=size;
00098    return current;      
00099 }  
00100 
00101 ClassImp(TGo4Status)
00102 
00103 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:05 2005 for Go4-v2.10-5 by doxygen1.2.15