Visual Computing Library
Loading...
Searching...
No Matches
edge_container.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_CONCEPTS_MESH_CONTAINERS_EDGE_CONTAINER_H
24#define VCL_CONCEPTS_MESH_CONTAINERS_EDGE_CONTAINER_H
25
26#include <vclib/concepts/const_correctness.h>
27#include <vclib/concepts/iterators.h>
28#include <vclib/concepts/ranges/range.h>
29
30#include <vector>
31
32namespace vcl {
33namespace mesh {
34
43template<typename T>
44concept HasEdgeContainer = requires (
45 T&& obj,
46 typename RemoveRef<T>::EdgeType e,
47 typename RemoveRef<T>::EdgeType* eP,
48 typename RemoveRef<T>::EdgeType& eR,
49 typename RemoveRef<T>::EdgeType::VertexType* vP,
50 std::vector<uint> vec) {
51 typename RemoveRef<T>::EdgeType;
52 typename RemoveRef<T>::EdgeIterator;
53 typename RemoveRef<T>::ConstEdgeIterator;
54
55 { obj.edge(uint()) } -> std::convertible_to<decltype(e)>;
56 { obj.edgeNumber() } -> std::same_as<uint>;
57 { obj.edgeContainerSize() } -> std::same_as<uint>;
58 { obj.deletedEdgeNumber() } -> std::same_as<uint>;
59
60 { obj.edgeIndexIfCompact(uint()) } -> std::same_as<uint>;
61 { obj.edgeCompactIndices() } -> std::same_as<decltype(vec)>;
62
63 { obj.edgeBegin() } -> InputIterator<decltype(e)>;
64 { obj.edgeEnd() } -> InputIterator<decltype(e)>;
65 { obj.edges() } -> InputRange<decltype(e)>;
66 { obj.edges(bool()) } -> InputRange<decltype(e)>;
67
68 // non const requirements
69 requires IsConst<T> || requires {
70 { obj.edge(uint()) } -> std::same_as<decltype(eR)>;
71
72 { obj.addEdge() } -> std::same_as<uint>;
73 { obj.addEdge(uint(), uint()) } -> std::same_as<uint>;
74 { obj.addEdge(vP, vP) } -> std::same_as<uint>;
75 { obj.addEdges(uint()) } -> std::same_as<uint>;
76 { obj.clearEdges() } -> std::same_as<void>;
77 { obj.resizeEdges(uint()) } -> std::same_as<void>;
78 { obj.reserveEdges(uint()) } -> std::same_as<void>;
79 { obj.compactEdges() } -> std::same_as<void>;
80 { obj.deleteEdge(uint()) } -> std::same_as<void>;
81 { obj.deleteEdge(eP) } -> std::same_as<void>;
82 { obj.updateEdgeIndices(vec) } -> std::same_as<void>;
83
84 { obj.edgeBegin() } -> OutputIterator<decltype(e)>;
85 { obj.edgeEnd() } -> OutputIterator<decltype(e)>;
86
87 { obj.edges() } -> OutputRange<decltype(e)>;
88 { obj.edges(bool()) } -> OutputRange<decltype(e)>;
89
90 { obj.enableAllPerEdgeOptionalComponents() } -> std::same_as<void>;
91 { obj.disableAllPerEdgeOptionalComponents() } -> std::same_as<void>;
92 };
93};
94
95} // namespace mesh
96
130template<typename... Args>
132
133} // namespace vcl
134
135#endif // VCL_CONCEPTS_MESH_CONTAINERS_EDGE_CONTAINER_H
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:131
The InputIterator concept is satisfied if T is an input iterator that implements the operator* return...
Definition iterators.h:46
Utility concept that is evaluated true the Range R is an Input Range and has a value_type that is con...
Definition range.h:89
The IsConst concept is satisfied if T satisfies one of the following conditions:
Definition const_correctness.h:43
The OutputIterator concept is satisfied if T is an output iterator that implements the operator* retu...
Definition iterators.h:60
Utility concept that is evaluated true the Range R is an Output Range and has a value_type that is T.
Definition range.h:113
The HasEdgeContainer concept is satisfied only if a container class provides the types and member fun...
Definition edge_container.h:44