GraphDom
Loading...
Searching...
No Matches
adj_list_base_iterator.h
1/*
2 * Copyright 2026 Michele Comparini
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef GRAPHDOM_ADJ_LIST_BASE_ITERATOR_H
8#define GRAPHDOM_ADJ_LIST_BASE_ITERATOR_H
9
10#include <variant>
11
12#include "../graph.h"
13#include "vertex_container.h"
14
15namespace graphdom {
16 template <typename VertexType>
17 template <typename VertexContainerPointerType>
18 class graph<VertexType>::adj_list_base_iterator {
19 public:
20 static_assert(
21 std::is_same< VertexContainerPointerType , graph<VertexType>::vertex_container* >::value ||
22 std::is_same< VertexContainerPointerType , const graph<VertexType>::vertex_container* >::value
23 ,
24 "The typename 'VertexContainerPointerType' of 'graphdom::graph<VertexType>::adj_list_base_iterator<VertexContainerPointerType>' class must be a pointer to graphdom::graph<VertexType>::vertex_container"
25 );
26
27 ~adj_list_base_iterator() = default;
28
29 template<typename K>
30 [[nodiscard]] constexpr bool operator==(const adj_list_base_iterator<K>& other_iterator) const;
31 template<typename K>
32 [[nodiscard]] constexpr bool operator!=(const adj_list_base_iterator<K>& other_iterator) const;
33
34 [[nodiscard]] constexpr graphdom::edge_type edge_type() const;
35
36 template<typename>
37 friend class graph<VertexType>::adj_list_base_iterator;
38 template<typename>
39 friend class graph<VertexType>::base_adj_list;
40 protected:
41 using special_begin_end_indicator = std::monostate;
42 using iterator_type =
43 std::variant<
44 special_begin_end_indicator,
45 typename graph<VertexType>::adj_set<graph<VertexType>::vertex_container*>::iterator,
46 typename graph<VertexType>::adj_set<const graph<VertexType>::vertex_container*>::iterator
47 >;
48
49 adj_list_base_iterator();
50 adj_list_base_iterator(const adj_list_base_iterator&) = default;
51 adj_list_base_iterator(
52 const graph<VertexType>* iterator_owner_pointer,
53 graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
54 VertexContainerPointerType edge_begin_point_vertex_container,
55 graph<VertexType>::edges_type_selection_type edges_type_restriction,
56 graphdom::edge_type inner_iterator_edge_current_type
57 );
58 adj_list_base_iterator(
59 const graph<VertexType>* iterator_owner_pointer,
60 graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
61 VertexContainerPointerType edge_begin_point_vertex_container,
62 graph<VertexType>::edges_type_selection_type edges_type_restriction,
63 graphdom::edge_type inner_iterator_edge_current_type,
64 const typename graph<VertexType>::adj_set<graph<VertexType>::vertex_container*>::iterator& inner_iterator
65 );
66 adj_list_base_iterator(
67 const graph<VertexType>* iterator_owner_pointer,
68 graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type,
69 VertexContainerPointerType edge_begin_point_vertex_container,
70 graph<VertexType>::edges_type_selection_type edges_type_restriction,
71 graphdom::edge_type inner_iterator_edge_current_type,
72 const typename graph<VertexType>::adj_set<const graph<VertexType>::vertex_container*>::iterator& inner_iterator
73 );
74
75 constexpr adj_list_base_iterator& internal_single_increment();
76
77 const graph<VertexType>* iterator_owner_graph;
78 graph<VertexType>::graph_edges_type iterator_owner_graph_edges_type;
79 VertexContainerPointerType edge_begin_point_vertex_container;
80 graph<VertexType>::edges_type_selection_type edges_type_restriction;
81 graphdom::edge_type inner_iterator_edge_current_type;
82 iterator_type inner_iterator;
83 private:
84 template <typename K>
85 constexpr adj_list_base_iterator& specialized_internal_single_increment();
86
87 template <typename K>
88 constexpr graph<VertexType>::adj_set<K>* get_adj_set_if_accessible(graphdom::edge_type edge_type) const;
89 };
90}
91
92#include "impl/adj_list_base_iterator.h"
93
94#endif //GRAPHDOM_ADJ_LIST_BASE_ITERATOR_H
Every graph created using this library is an instance of a concrete class publicly derived,...
Definition graph.h:43
Definition adj_list.h:16
edge_type
The enumerated type whose values represent the two types of edges of a graph.
Definition graph.h:21