GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ParameterStatus.cxx
Go to the documentation of this file.
1 // $Id$
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 fuer 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 "TROOT.h"
17 #include "TClass.h"
18 #include "TObjArray.h"
19 
20 #include "TGo4Log.h"
21 #include "TGo4Parameter.h"
22 
25 {
26 }
27 
29  TGo4ObjectStatus(par)
30 {
31  if (par && membervalues) {
32  fxMemberValues = new TObjArray();
33  fxMemberValues->SetOwner(kTRUE);
35  }
36 }
37 
38 TGo4ParameterStatus::TGo4ParameterStatus(const char *parname, const char *parclass, TObjArray *items) :
40 {
41  fxMemberValues = items;
42  SetName(parname);
43  SetTitle("TGo4ParameterStatus title");
44  fxObjectClass = parclass;
45 }
46 
47 
49 {
50  if (fxMemberValues) {
51  delete fxMemberValues;
52  fxMemberValues = nullptr;
53  }
54 }
55 
56 TObjArray *TGo4ParameterStatus::GetMemberValues(Bool_t takeit)
57 {
58  TObjArray *res = fxMemberValues;
59  if (takeit) fxMemberValues = nullptr;
60  return res;
61 }
62 
64 {
65  if (!par || !fxMemberValues) 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  auto parclass = gROOT->GetClass(GetObjectClass());
83  if (!parclass || !fxMemberValues) return nullptr;
84 
85  TGo4Parameter *par = (TGo4Parameter*) parclass->New();
86 
87  if (!par) return nullptr;
88 
89  par->SetName(GetName());
91 
92  return par;
93 }
94 
95 void TGo4ParameterStatus::Print(Option_t *) const
96 {
98  PrintLine("G-OOOO-> Parameter Status Class Printout <-OOOO-G");
99  PrintLine("G-OOOO-> ---------------------------------------------- <-OOOO-G");
100 }
Bool_t UpdateParameterValues(TGo4Parameter *par)
TObjArray * GetMemberValues(Bool_t takeit=kFALSE)
TGo4Parameter * CreateParameter()
virtual Bool_t CustomUpdateFrom() const
Definition: TGo4Parameter.h:54
const char * GetObjectClass() const
void Print(Option_t *opt="") const override
void Print(Option_t *opt="") const override
Bool_t SetMemberValues(TObjArray *fItems)
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
static void PrintLine(const char *text,...)
Definition: TGo4Status.cxx:101
void GetMemberValues(TObjArray *fItems)