GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 16 / 0 / 16
Functions: 100.0% 10 / 0 / 10
Branches: -% 0 / 0 / 0

src/graph/ds/eog/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../graph_c/lib.hpp"
4
5 namespace tifa_libs {
6 namespace eog_impl_ {
7 template <class T, class... Info>
8 class eog_tag : public graph_info_impl_::graph_tag_base<Info...> {
9 using base_t = graph_info_impl_::graph_tag_base<Info...>;
10 using ET = graph_info_impl_::E<T>;
11 struct iter_ {
12 vecp<ET, u32> CR e;
13 u32 i;
14
15 3448509 iter_(vecp<ET, u32> CR e, u32 i) NE : e(e), i(i) {}
16
17 1149503 ND CEXP auto begin() CNE { return iter_{e, i}; }
18 1149503 ND CEXP auto end() CNE { return iter_{e, -1_u32}; }
19
20 3075656 CEXP auto operator*() CNE { return e[i].first; }
21 3075656 CEXP iter_& operator++() NE {
22 3075656 i = e[i].second;
23 3075656 return *this;
24 }
25 4225159 CEXP bool operator!=(iter_ const& r) CNE { return i != r.i; }
26 };
27
28 vecu head;
29 vecp<ET, u32> e{};
30
31 protected:
32 using val_t = T;
33 42 CEXPE eog_tag(u32 n) NE : base_t(n), head(n, -1_u32) {}
34
35 public:
36 3075656 CEXP void add_arc(u32 u, auto&&... args) NE {
37 3075656 base_t::add_arc(u, std::forward<decltype(args)>(args)...);
38 3075656 e.emplace_back(ET(std::forward<decltype(args)>(args)...), head[u]);
39 3075656 head[u] = u32(e.size() - 1);
40 3075656 }
41 63 ND CEXP u32 vsize() CNE { return (u32)head.size(); }
42 CEXP void build() CNE {}
43 CEXP void pop_startwith(u32 u) NE { base_t::del_arc(u, e[head[u]].first.to), head[u] = e[head[u]].second; }
44
45 1149503 CEXP auto operator[](u32 u) CNE { return iter_{e, head[u]}; }
46 };
47 } // namespace eog_impl_
48 template <class Et = void, class... Info>
49 using eog = graph_impl_::graph<eog_impl_::eog_tag<Et, Info...>>;
50
51 } // namespace tifa_libs
52