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

TGo4ParameterStatus.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 "TGo4ParameterStatus.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TObjArray.h"
00021 #include "TROOT.h"
00022 #include "TClass.h"
00023 
00024 #include "TGo4Log.h"
00025 #include "TGo4Parameter.h"
00026 
00027 TGo4ParameterStatus::TGo4ParameterStatus() :
00028    TGo4ObjectStatus(),
00029    fxMemberValues(0)
00030 {
00031 }
00032 
00033 TGo4ParameterStatus::TGo4ParameterStatus(TGo4Parameter* par, Bool_t membervalues) :
00034    TGo4ObjectStatus(par),
00035    fxMemberValues(0)
00036 {
00037    if ((par!=0) && membervalues) {
00038       fxMemberValues = new TObjArray();
00039       fxMemberValues->SetOwner(kTRUE);
00040       par->GetMemberValues(fxMemberValues);
00041    }
00042 }
00043 
00044 TGo4ParameterStatus::TGo4ParameterStatus(const char* parname, const char* parclass, TObjArray* items) :
00045    TGo4ObjectStatus(),
00046    fxMemberValues(items)
00047 {
00048    SetName(parname);
00049    SetTitle("TGo4ParameterStatus title");
00050    fxObjectClass = parclass;
00051 }
00052 
00053 
00054 TGo4ParameterStatus::~TGo4ParameterStatus()
00055 {
00056    if (fxMemberValues!=0) delete fxMemberValues;
00057 }
00058 
00059 TObjArray* TGo4ParameterStatus::GetMemberValues(Bool_t takeit)
00060 {
00061    TObjArray* res = fxMemberValues;
00062    if (takeit) fxMemberValues = 0;
00063    return res;
00064 }
00065 
00066 Bool_t TGo4ParameterStatus::UpdateParameterValues(TGo4Parameter* par)
00067 {
00068    if ((par==0) || (fxMemberValues==0)) return kFALSE;
00069    if (strcmp(GetObjectClass(), par->ClassName())!=0) return kFALSE;
00070 
00071    Bool_t res = kFALSE;
00072 
00073    if (par->CustomUpdateFrom()) {
00074       TGo4Parameter* copypar = CreateParameter();
00075       res = par->UpdateFrom(copypar);
00076       delete copypar;
00077    } else {
00078       res = par->SetMemberValues(fxMemberValues);
00079    }
00080 
00081    return kTRUE;
00082 
00083 }
00084 
00085 TGo4Parameter* TGo4ParameterStatus::CreateParameter()
00086 {
00087    TClass* parclass = gROOT->GetClass(GetObjectClass());
00088    if ((parclass==0) || (fxMemberValues==0)) return 0;
00089 
00090    TGo4Parameter* par = (TGo4Parameter*) parclass->New();
00091 
00092    if (par==0) return 0;
00093 
00094    par->SetName(GetName());
00095    par->SetMemberValues(fxMemberValues);
00096 
00097    return par;
00098 }
00099 
00100 Int_t TGo4ParameterStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00101 {
00102    TRACE((12,"TGo4ParameterStatus::PrintStatus()",__LINE__, __FILE__));
00103    if(buflen<=0 && buffer!=0)
00104       return 0;
00105    Int_t locallen=128000;
00106    Text_t localbuf[128000];
00107    Int_t size=0;
00108    Text_t* current=localbuf;
00109    Int_t restlen=locallen;
00110    Int_t delta   = TGo4ObjectStatus::PrintStatus(current,restlen);
00111    restlen-=delta;
00112    current+=delta;
00113    current=PrintIndent(current,restlen);
00114    current=PrintBuffer(current,restlen, "G-OOOO-> Parameter Status Class Printout <-OOOO-G\n");
00115    current=PrintIndent(current,restlen);
00116    current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00117    // put printout of condition infos here:
00118 
00120   if(buffer==0)
00121       {
00122           cout << localbuf << endl;
00123       }
00124    else
00125       {
00126          size=locallen-restlen;
00127          if(size>buflen-1)
00128                size=buflen-1;
00129          strncpy(buffer,localbuf,size);
00130       }
00131    return size;
00132 }
00133 
00134 
00135 //----------------------------END OF GO4 SOURCE FILE ---------------------

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