HLTGlobalStatus.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
5 
6 #include <algorithm>
7 #include <atomic>
8 #include <cstddef>
9 #include <ostream>
10 #include <string>
11 #include <vector>
12 
13 using namespace std;
14 using namespace literals::string_literals;
15 
16 namespace art {
17 
18  HLTGlobalStatus::~HLTGlobalStatus() = default;
19 
20  HLTGlobalStatus::HLTGlobalStatus(std::size_t const n /* = 0 */) : paths_(n) {}
21 
24 
27 
28  std::size_t
30  {
31  return paths_.size();
32  }
33 
34  void
36  {
37  std::for_each(begin(paths_), end(paths_), [](auto& path_status) {
38  path_status.reset();
39  });
40  }
41 
42  bool
44  {
45  return std::any_of(begin(paths_), end(paths_), [](auto const& path_status) {
46  return path_status.state() != hlt::Ready;
47  });
48  }
49 
50  bool
52  {
53  if (empty(paths_)) {
54  return true;
55  }
56 
57  bool at_least_one_ran = false;
58  bool at_least_one_accepted = false;
59 
60  for (auto const& path_status : paths_) {
61  auto const s(path_status.state());
62  if (s != hlt::Ready) {
63  at_least_one_ran = true;
64  if (s == hlt::Pass) {
65  at_least_one_accepted = true;
66  }
67  }
68  }
69 
70  if (!at_least_one_ran) {
71  return true;
72  }
73  return at_least_one_accepted;
74  }
75 
76  bool
78  {
79  return std::any_of(begin(paths_), end(paths_), [](auto const& path_status) {
80  return path_status.state() == hlt::Exception;
81  });
82  }
83 
84  HLTPathStatus const&
85  HLTGlobalStatus::at(unsigned const i) const
86  {
87  return paths_.at(i);
88  }
89 
91  HLTGlobalStatus::at(unsigned const i)
92  {
93  return paths_.at(i);
94  }
95 
96  bool
97  HLTGlobalStatus::wasrun(unsigned const i) const
98  {
99  return paths_.at(i).wasrun();
100  }
101 
102  bool
103  HLTGlobalStatus::accept(unsigned const i) const
104  {
105  return paths_.at(i).accept();
106  }
107 
108  bool
109  HLTGlobalStatus::error(unsigned const i) const
110  {
111  return paths_.at(i).error();
112  }
113 
115  HLTGlobalStatus::state(unsigned const i) const
116  {
117  return paths_.at(i).state();
118  }
119 
120  unsigned
121  HLTGlobalStatus::index(unsigned const i) const
122  {
123  return paths_.at(i).index();
124  }
125 
126  void
127  HLTGlobalStatus::reset(unsigned const i)
128  {
129  paths_.at(i).reset();
130  atomic_thread_fence(memory_order_seq_cst);
131  }
132 
133  ostream&
134  operator<<(ostream& ost, const HLTGlobalStatus& hlt)
135  {
136  vector<string> text{"n"s, "1"s, "0"s, "e"s};
137  unsigned const n(hlt.size());
138  for (auto i = 0U; i < n; ++i) {
139  ost << text.at(hlt.state(i));
140  }
141  return ost;
142  }
143 
144 } // namespace art
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
unsigned index(unsigned const i) const
std::vector< HLTPathStatus > paths_
STL namespace.
HLTState
Definition: HLTenums.h:6
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
std::void_t< T > n
HLTGlobalStatus & operator=(HLTGlobalStatus const &)
HLTGlobalStatus(std::size_t n=0)
hlt::HLTState state(unsigned const i) const
std::size_t size() const
HLTPathStatus const & at(unsigned const i) const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
static QCString * s
Definition: config.cpp:1042
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97