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 
52  void Add(const run_index_t& r)
53  {
54  fRunList.insert(r);
55  }
56  void Add(const run_index_list&);
57  void Remove(const run_index_t& r)
58  {
59  fRunList.erase(r);
60  }
61  void Remove(const run_index_list&);
62 
63  bool Contains(const run_index_t& r) const
64  {
65  return fRunList.count(r) > 0;
66  }
67  bool IsEmpty() const
68  {
69  return fRunList.empty();
70  }
71  TString GetList(bool no_commas=true) const;
72  void SetList(const TString& slist);
73  TString AsString(Int_t maxlen = 0) const;
74  Int_t GetNValues() const
75  {
76  return fRunList.size();
77  }
78  Int_t GetEntries() const
79  {
80  return GetNValues();
81  }
82  void Clear()
83  {
84  fRunList.clear();
85  }
86  void ls() const
87  {
88  std::cout << AsString() << std::endl;
89  }
90  void Inter(const run_index_list&);
91  KVNumberList GetRunNumberList() const;
92 
93  friend run_index_list operator-(const run_index_list& A, const run_index_list& B)
94  {
95  auto tmp = A;
96  tmp.Remove(B);
97  return tmp;
98  }
99 
100  friend run_index_list operator+(const run_index_list& A, const run_index_list& B)
101  {
102  auto tmp = A;
103  tmp.Add(B);
104  return tmp;
105  }
106 
107  const run_index_t& First() const
108  {
110  auto it = fRunList.cbegin();
111  return *it;
112  }
113  const run_index_t& Last() const
114  {
116  auto it = fRunList.crbegin();
117  return *it;
118  }
119 
120  ClassDef(run_index_list, 0)
121 };
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