GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ListCond.h
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 #ifndef TGO4LISTCOND_H
15 #define TGO4LISTCOND_H
16 
17 #include "TGo4Condition.h"
18 #include <vector>
19 
26 {
27 public:
28  TGo4ListCond();
29  TGo4ListCond(const char *name, const char *title = "Go4 list condition");
30  TGo4ListCond(const char *name, const char *title, const Int_t num, const Int_t *values);
31  TGo4ListCond(const char *name, const char *title, const Int_t start, const Int_t stop, const Int_t step = 1);
32  virtual ~TGo4ListCond();
33 
35  virtual void SetValues(const Int_t num, const Int_t * values);
36  virtual void SetValues(const Int_t start, const Int_t stop, const Int_t step);
37 
38  using TGo4Condition::Test;
39  Bool_t Test(Double_t value) override;
40 
41  void PrintCondition(Bool_t full = kFALSE) override;
42  void PrintValues();
43 
44  Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts) override;
45 
46  UInt_t GetNumValues() const { return fxValues.size(); }
47 
48  Int_t GetValue(UInt_t ix) const { return ix < fxValues.size() ? fxValues[ix] : 0; }
49 
50  void SetValue(UInt_t ix, Int_t val)
51  {
52  if (ix >= fxValues.size())
53  fxValues.resize(ix);
54  fxValues[ix] = val;
55  }
56 
57  void InsertValue(UInt_t ix, Int_t val) { fxValues.insert(fxValues.begin() + ix, val); }
58 
59  void RemoveValue(UInt_t ix) { fxValues.erase(fxValues.begin() + ix); }
60 
61  void Resize(size_t newsize) { fxValues.resize(newsize); }
62 
64  Double_t GetXLow() const override;
65 
67  Double_t GetXUp() const override;
68 
70  Double_t GetYLow() const override;
71 
73  Double_t GetYUp() const override;
74 
78  /* virtual TGo4ConditionPainter *CreatePainter();*/
79 
80 private:
81 
82  std::vector<Int_t> fxValues;
83 
84 // /** number of values in list: todo: use vector here?*/
85 // Int_t fiNum;
86 // /** array with values to test: todo: use vector here?*/
87 // Int_t * fiValues;
88 
90 };
91 
92 #endif // TGO4LISTCOND_H
Double_t GetYLow() const override
void RemoveValue(UInt_t ix)
Definition: TGo4ListCond.h:59
void InsertValue(UInt_t ix, Int_t val)
Definition: TGo4ListCond.h:57
virtual ~TGo4ListCond()
virtual void SetValues()
Definition: TGo4Condition.h:93
Double_t GetXLow() const override
Int_t GetValue(UInt_t ix) const
Definition: TGo4ListCond.h:48
Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts) override
void SetValue(UInt_t ix, Int_t val)
Definition: TGo4ListCond.h:50
ClassDefOverride(TGo4ListCond, 1)
Double_t GetXUp() const override
UInt_t GetNumValues() const
Definition: TGo4ListCond.h:46
virtual Bool_t Test()
std::vector< Int_t > fxValues
Definition: TGo4ListCond.h:82
void PrintCondition(Bool_t full=kFALSE) override
void Resize(size_t newsize)
Definition: TGo4ListCond.h:61
void PrintValues()
Double_t GetYUp() const override