KaliVeda
Toolkit for HIC analysis
run_index_list.h
1 #pragma once
2 
3 #include "run_index.h"
4 #include <set>
5 #include "KVNumberList.h"
6 
30 class run_index_list {
31  std::set<run_index_t> fRunList;
32 public:
33  run_index_list(const TString& l)
34  {
35  SetList(l);
36  }
37  run_index_list() = default;
38  run_index_list(const run_index_list&) = default;
39  run_index_list(run_index_list&&) = default;
40  run_index_list& operator=(const run_index_list&) = default;
41  run_index_list& operator=(run_index_list&&) = default;
42 
43  auto begin() const
44  {
45  return std::begin(fRunList);
46  }
47  auto end() const
48  {
49  return std::end(fRunList);
50  }
51  auto rbegin() const
52  {
53  return std::rbegin(fRunList);
54  }
55  auto rend() const
56  {
57  return std::rend(fRunList);
58  }
59 
60  void Add(const run_index_t& r)
61  {
62  fRunList.insert(r);
63  }
64  void Add(const run_index_list&);
65  void Remove(const run_index_t& r)
66  {
67  fRunList.erase(r);
68  }
69  void Remove(const run_index_list&);
70 
71  bool Contains(const run_index_t& r) const
72  {
73  return fRunList.count(r) > 0;
74  }
75  bool IsEmpty() const
76  {
77  return fRunList.empty();
78  }
79  TString GetList(bool no_commas = true) const;
80  void SetList(const TString& slist);
81  void SetListSelection(const TString& slist, const run_index_list& full_list);
82  TString AsString(Int_t maxlen = 0) const;
83  Int_t GetNValues() const
84  {
85  return fRunList.size();
86  }
87  Int_t GetEntries() const
88  {
89  return GetNValues();
90  }
91  void Clear()
92  {
93  fRunList.clear();
94  }
95  void ls() const
96  {
97  std::cout << AsString() << std::endl;
98  }
99  void Inter(const run_index_list&);
100  KVNumberList GetRunNumberList() const;
101 
102  friend run_index_list operator-(const run_index_list& A, const run_index_list& B)
103  {
104  auto tmp = A;
105  tmp.Remove(B);
106  return tmp;
107  }
108 
109  friend run_index_list operator+(const run_index_list& A, const run_index_list& B)
110  {
111  auto tmp = A;
112  tmp.Add(B);
113  return tmp;
114  }
115 
116  const run_index_t& First() const
117  {
119  auto it = fRunList.cbegin();
120  return *it;
121  }
122  const run_index_t& Last() const
123  {
125  auto it = fRunList.crbegin();
126  return *it;
127  }
128 
129  ClassDef(run_index_list, 0)
130 };
int Int_t
#define ClassDef(name, id)
Binding & operator=(OUT(*fun)(U0 u0))
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:31
Expr< BinaryOpCopyL< MinOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > operator-(const A &lhs, const SMatrix< T, D, D2, R > &rhs)
Expr< BinaryOpCopyL< AddOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > operator+(const A &lhs, const SMatrix< T, D, D2, R > &rhs)
Add
end