GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ParameterStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4ParameterStatus.cxx 1439 2015-05-21 10:45:56Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4ParameterStatus.h"
15 
16 #include "Riostream.h"
17 #include "TObjArray.h"
18 #include "TROOT.h"
19 #include "TClass.h"
20 
21 #include "TGo4Log.h"
22 #include "TGo4Parameter.h"
23 
26  fxMemberValues(0)
27 {
28 }
29 
31  TGo4ObjectStatus(par),
32  fxMemberValues(0)
33 {
34  if ((par!=0) && membervalues) {
35  fxMemberValues = new TObjArray();
36  fxMemberValues->SetOwner(kTRUE);
38  }
39 }
40 
41 TGo4ParameterStatus::TGo4ParameterStatus(const char* parname, const char* parclass, TObjArray* items) :
43  fxMemberValues(items)
44 {
45  SetName(parname);
46  SetTitle("TGo4ParameterStatus title");
47  fxObjectClass = parclass;
48 }
49 
50 
52 {
53  if (fxMemberValues!=0) delete fxMemberValues;
54 }
55 
56 TObjArray* TGo4ParameterStatus::GetMemberValues(Bool_t takeit)
57 {
58  TObjArray* res = fxMemberValues;
59  if (takeit) fxMemberValues = 0;
60  return res;
61 }
62 
64 {
65  if ((par==0) || (fxMemberValues==0)) return kFALSE;
66  if (strcmp(GetObjectClass(), par->ClassName())!=0) return kFALSE;
67 
68  if (par->CustomUpdateFrom()) {
69  TGo4Parameter* copypar = CreateParameter();
70  par->UpdateFrom(copypar);
71  delete copypar;
72  } else {
74  }
75 
76  return kTRUE;
77 
78 }
79 
81 {
82  TClass* parclass = gROOT->GetClass(GetObjectClass());
83  if ((parclass==0) || (fxMemberValues==0)) return 0;
84 
85  TGo4Parameter* par = (TGo4Parameter*) parclass->New();
86 
87  if (par==0) return 0;
88 
89  par->SetName(GetName());
91 
92  return par;
93 }
94 
95 Int_t TGo4ParameterStatus::PrintStatus(Text_t* buffer, Int_t buflen)
96 {
97  GO4TRACE((12,"TGo4ParameterStatus::PrintStatus()",__LINE__, __FILE__));
98  if(buflen<=0 && buffer!=0) return 0;
99  Int_t locallen = 128000;
100  Text_t localbuf[128000];
101  Int_t size=0;
102  Text_t* current = localbuf;
103  Int_t restlen = locallen;
104  Int_t delta = TGo4ObjectStatus::PrintStatus(current,restlen);
105  restlen -= delta;
106  current += delta;
107  current = PrintIndent(current, restlen);
108  current = PrintBuffer(current, restlen, "G-OOOO-> Parameter Status Class Printout <-OOOO-G\n");
109  current = PrintIndent(current, restlen);
110  current = PrintBuffer(current, restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
111  // put printout of condition infos here:
112 
114  if(buffer==0) {
115  std::cout << localbuf << std::endl;
116  } else {
117  size = locallen-restlen;
118  if(size>buflen-1) size = buflen-1;
119  strncpy(buffer,localbuf,size);
120  }
121  return size;
122 }
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
Bool_t UpdateParameterValues(TGo4Parameter *par)
TObjArray * GetMemberValues(Bool_t takeit=kFALSE)
static Text_t * PrintIndent(Text_t *buffer, Int_t &buflen)
Definition: TGo4Status.cxx:72
TGo4Parameter * CreateParameter()
Bool_t SetMemberValues(TObjArray *fItems)
const char * GetObjectClass() const
#define GO4TRACE(X)
Definition: TGo4Log.h:26
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
virtual Bool_t CustomUpdateFrom() const
Definition: TGo4Parameter.h:55
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:85
void GetMemberValues(TObjArray *fItems)