Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4Status.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "Riostream.h"
00020 
00021 #include "TROOT.h"
00022 #include "snprintf.h"
00023 
00024 #include "TGo4Log.h"
00025 
00026 TGo4Status::TGo4Status() :
00027    TNamed()
00028 {
00029 }
00030 
00031 TGo4Status::TGo4Status(const char* name) :
00032    TNamed(name, "This is a Go4 Status Object")
00033 {
00034    TRACE((12,"TGo4Status::TGo4Status(const char*)",__LINE__, __FILE__));
00035 }
00036 
00037 TGo4Status::TGo4Status(const char* name, const char* title) :
00038    TNamed(name, title)
00039 {
00040    TRACE((12,"TGo4Status::TGo4Status(Text_t*, Text_t*)",__LINE__, __FILE__));
00041 }
00042 
00043 TGo4Status::~TGo4Status()
00044 {
00045    TRACE((12,"TGo4Status::~TGo4Status()",__LINE__, __FILE__));
00046 }
00047 
00048 void TGo4Status::Print(Option_t* dummy) const
00049 {
00050    // this trick is needed since root defines Print as const function...
00051    TGo4Status* const localthis= const_cast<TGo4Status* const>(this);
00052    localthis->PrintStatus();
00053 }
00054 
00055 Int_t TGo4Status::PrintStatus(Text_t* buffer, Int_t buflen)
00056 {
00057    TRACE((12,"TGo4Status::PrintStatus()",__LINE__, __FILE__));
00058    //
00059    if(buflen<=0 && buffer!=0)
00060       return 0;
00061    Int_t locallen=2048;
00062    Text_t localbuf[2048];
00063    Int_t size=0;
00064    size=snprintf(localbuf, locallen-1,
00065                      "G-OOOO-> Status Class %s, name: %s <-OOOO-G\n",
00066                         ClassName(), GetName());
00067    if(buffer==0)
00068       {
00069           cout << localbuf << endl;
00070       }
00071    else
00072       {
00073          if(size>buflen-1)
00074             size=buflen-1;
00075          strncpy(buffer,localbuf,size);
00076       }
00077    return size;
00078 }
00079 
00080 Text_t* TGo4Status::PrintIndent(Text_t* buffer, Int_t& buflen)
00081 {
00082    if(buflen<0 && buffer!=0) return 0;
00083    Int_t restlen=buflen;
00084    Text_t* cursor=buffer;
00085    for (int i = 0; (i < TROOT::GetDirLevel()) && (i< buflen); i++)
00086       {
00087          cursor=PrintBuffer(cursor,restlen," ");
00088       }
00089    buflen=restlen;
00090    return cursor;
00091 }
00092 
00093 Text_t* TGo4Status::PrintBuffer(Text_t* buffer, Int_t& buflen, const Text_t* text,...)
00094 {
00095    if(buffer==0 || buflen<0) return 0;
00096    va_list args;
00097    va_start(args, text);
00098    Int_t size=vsnprintf(buffer, buflen, text, args);
00099    va_end(args);
00100    if(size>buflen || size<0) return 0;
00101    Text_t* current= buffer + size;
00102    buflen-=size;
00103    return current;
00104 }
00105 
00106 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:29 2008 for Go4-v3.04-1 by  doxygen 1.4.2