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