GraphDom
Loading...
Searching...
No Matches
const_adj_list.h
1/*
2 * Copyright 2026 Michele Comparini
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef GRAPHDOM_CONST_ADJ_LIST_IMPL_H
8#define GRAPHDOM_CONST_ADJ_LIST_IMPL_H
9
10#include "../../graph.h"
11#include "../base_adj_list.h"
12#include "../const_adj_list.h"
13
14template <typename VertexType>
15graphdom::graph<VertexType>::const_adj_list::const_adj_list(const const_adj_list& other) :
16graph<VertexType>::base_adj_list< const graph<VertexType>::vertex_container* >( other ){}
17
18template<typename VertexType>
19graphdom::graph<VertexType>::const_adj_list::const_adj_list(const typename graph<VertexType>::adj_list& other) :
20graph<VertexType>::base_adj_list< const graph<VertexType>::vertex_container* >(
21 other.adj_list_owner_graph_pointer,
22 other.adj_list_owner_graph_edges_type,
23 other.adj_list_common_begin_point_vertex_container_pointer,
24 other.adj_list_edges_type_selection
25){}
26
27template<typename VertexType>
28graphdom::graph<VertexType>::const_adj_list::const_adj_list(const typename multiset_graph<VertexType>::adj_list& other) :
29graph<VertexType>::base_adj_list< const graph<VertexType>::vertex_container* >(
30 other.adj_list_owner_graph_pointer,
31 other.adj_list_owner_graph_edges_type,
32 other.adj_list_common_begin_point_vertex_container_pointer,
33 other.adj_list_edges_type_selection
34){}
35
36template<typename VertexType>
37typename graphdom::graph<VertexType>::adj_list_const_iterator graphdom::graph<VertexType>::const_adj_list::begin() const {
38 if ( dynamic_cast< const graphdom::multiset_graph<VertexType>* >( this->adj_list_owner_graph_pointer ) != nullptr ) {
39 return graphdom::graph<VertexType>::adj_list_const_iterator( this->template internal_begin<graphdom::graph<VertexType>::vertex_container*>() );
40 }
41 return graphdom::graph<VertexType>::adj_list_const_iterator( this->template internal_begin<const graphdom::graph<VertexType>::vertex_container*>() );
42}
43
44template<typename VertexType>
45typename graphdom::graph<VertexType>::adj_list_const_iterator graphdom::graph<VertexType>::const_adj_list::end() const {
46 if ( dynamic_cast< const graphdom::multiset_graph<VertexType>* >( this->adj_list_owner_graph_pointer ) != nullptr ) {
47 return graphdom::graph<VertexType>::adj_list_const_iterator( this->template internal_end<graphdom::graph<VertexType>::vertex_container*>() );
48 }
49 return graphdom::graph<VertexType>::adj_list_const_iterator( this->template internal_end<const graphdom::graph<VertexType>::vertex_container*>() );
50}
51
52template<typename VertexType>
53typename graphdom::graph<VertexType>::adj_list_const_iterator graphdom::graph<VertexType>::const_adj_list::cbegin() const {
54 return begin();
55}
56
57template<typename VertexType>
58typename graphdom::graph<VertexType>::adj_list_const_iterator graphdom::graph<VertexType>::const_adj_list::cend() const {
59 return end();
60}
61
62template<typename VertexType>
63graphdom::graph<VertexType>::const_adj_list::const_adj_list(
64 const graphdom::graph<VertexType>* const adj_list_owner_graph_pointer,
65 const typename graphdom::graph<VertexType>::graph_edges_type adj_list_owner_graph_edges_type,
66 const typename graphdom::graph<VertexType>::vertex_container* const adj_list_common_begin_point_vertex_container_pointer,
67 const typename graphdom::graph<VertexType>::edges_type_selection_type adj_list_edges_type_selection ) :
68graph<VertexType>::base_adj_list< const graph<VertexType>::vertex_container* >(
69 adj_list_owner_graph_pointer,
70 adj_list_owner_graph_edges_type,
71 adj_list_common_begin_point_vertex_container_pointer,
72 adj_list_edges_type_selection
73){}
74
75#endif //GRAPHDOM_CONST_ADJ_LIST_IMPL_H
Every graph created using this library is an instance of a concrete class publicly derived,...
Definition graph.h:43