Wildmeshing Toolkit
Loading...
Searching...
No Matches
AttributeHandle.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <type_traits>
4
5// TODO: is this abstraction still necessary? the original attempt was to have a generic index that
6// avoided passing templates around, but in the end we still obtained a TypedAttributeHandle<T> and
7// used variant to remove the templating + introduce multimesh
8
9namespace wmtk {
10template <typename T>
11class hash;
12class Mesh;
13namespace attribute {
14template <typename T>
15class MeshAttributes;
16template <typename T>
18class AttributeManager;
19
24{
25protected:
26public:
27 template <typename T>
28 friend class MeshAttributes;
29 template <typename T>
31 friend class AttributeManager;
32 friend class wmtk::hash<AttributeHandle>;
33 friend class Mesh;
34
35 int64_t index = -1;
36 AttributeHandle(int64_t i) noexcept
37 : index(i)
38 {}
39
40public:
41 AttributeHandle() = default;
46
47
48 bool operator==(const AttributeHandle& other) const noexcept { return index == other.index; }
49 bool operator<(const AttributeHandle& other) const noexcept { return index < other.index; }
50
51 bool is_valid() const noexcept { return index != -1; }
52};
53
54} // namespace attribute
56} // namespace wmtk
Internal handle representation used by MeshAttributes.
bool operator<(const AttributeHandle &other) const noexcept
AttributeHandle(AttributeHandle &&)=default
AttributeHandle & operator=(const AttributeHandle &)=default
AttributeHandle(const AttributeHandle &)=default
AttributeHandle & operator=(AttributeHandle &&)=default
bool operator==(const AttributeHandle &other) const noexcept
Contains all attributes of type T for a single mesh.
Handle that represents attributes for some mesh.
attribute::TypedAttributeHandle< T > TypedAttributeHandle