Visual Computing Library
Loading...
Searching...
No Matches
vertex_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_VERTEX_CONTAINER_H
24#define VCL_CONCEPTS_MESH_CONTAINERS_VERTEX_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 HasVertexContainer = requires (
45 T&& obj,
46 typename RemoveRef<T>::VertexType v,
47 typename RemoveRef<T>::VertexType* vP,
48 typename RemoveRef<T>::VertexType& vR,
49 typename RemoveRef<T>::VertexType::CoordType c,
50 std::vector<uint> vec) {
51 typename RemoveRef<T>::VertexType;
52 typename RemoveRef<T>::VertexIterator;
53 typename RemoveRef<T>::ConstVertexIterator;
54
55 { obj.vertex(uint()) } -> std::convertible_to<decltype(v)>;
56 { obj.vertexNumber() } -> std::same_as<uint>;
57 { obj.vertexContainerSize() } -> std::same_as<uint>;
58 { obj.deletedVertexNumber() } -> std::same_as<uint>;
59
60 { obj.vertexIndexIfCompact(uint()) } -> std::same_as<uint>;
61 { obj.vertexCompactIndices() } -> std::same_as<decltype(vec)>;
62
63 { obj.vertexBegin() } -> InputIterator<decltype(v)>;
64 { obj.vertexEnd() } -> InputIterator<decltype(v)>;
65 { obj.vertices() } -> InputRange<decltype(v)>;
66 { obj.vertices(bool()) } -> InputRange<decltype(v)>;
67
68 // non const requirements
69 requires IsConst<T> || requires {
70 { obj.vertex(uint()) } -> std::same_as<decltype(vR)>;
71
72 { obj.addVertex() } -> std::same_as<uint>;
73 { obj.addVertex(c) } -> std::same_as<uint>;
74 { obj.addVertices(uint()) } -> std::same_as<uint>;
75 { obj.addVertices(c, c, c, c) } -> std::same_as<uint>;
76 { obj.clearVertices() } -> std::same_as<void>;
77 { obj.resizeVertices(uint()) } -> std::same_as<void>;
78 { obj.reserveVertices(uint()) } -> std::same_as<void>;
79 { obj.compactVertices() } -> std::same_as<void>;
80 { obj.deleteVertex(uint()) } -> std::same_as<void>;
81 { obj.deleteVertex(vP) } -> std::same_as<void>;
82 { obj.updateVertexIndices(vec) } -> std::same_as<void>;
83
84 { obj.vertexBegin() } -> OutputIterator<decltype(v)>;
85 { obj.vertexEnd() } -> OutputIterator<decltype(v)>;
86 { obj.vertices() } -> OutputRange<decltype(v)>;
87 { obj.vertices(bool()) } -> OutputRange<decltype(v)>;
88
89 { obj.enableAllPerVertexOptionalComponents() } -> std::same_as<void>;
90 { obj.disableAllPerVertexOptionalComponents() } -> std::same_as<void>;
91 };
92};
93
94} // namespace mesh
95
129template<typename... Args>
131
132} // namespace vcl
133
134#endif // VCL_CONCEPTS_MESH_CONTAINERS_VERTEX_CONTAINER_H
HasVertices concepts is satisfied when at least one of its types is (or inherits from) a vcl::mesh::V...
Definition vertex_container.h:130
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 HasVertexContainer concept is satisfied only if a container class provides the types and member f...
Definition vertex_container.h:44