Wildmeshing Toolkit
TypedAttributeHandle.hpp
Go to the documentation of this file.
1 
2 #pragma once
3 #include <wmtk/PrimitiveType.hpp>
4 #include "AttributeHandle.hpp"
5 namespace wmtk {
6 class Mesh;
7 class Rational;
8 namespace attribute {
9 template <typename T>
10 class MeshAttributes;
11 template <typename T, int Dim>
12 class AccessorBase;
13 template <typename T, typename MeshType, int Dim>
14 class Accessor;
15 
16 class AttributeManager;
17 
18 class MeshAttributeHandle;
19 
26 template <typename T>
28 {
29 public:
30  using Type = T;
31 
32 private:
33  friend class wmtk::Mesh;
34  friend class MeshAttributes<T>;
35  template <typename U, int Dim>
36  friend class AccessorBase;
37  template <typename U, typename MeshType, int Dim>
38  friend class Accessor;
39  friend class AttributeManager;
40  friend class wmtk::hash<TypedAttributeHandle<T>>;
43 
45  : m_base_handle(ah)
46  , m_primitive_type(pt)
47  {}
50  {}
51 
53 
54 public:
55  using value_type = T;
56  TypedAttributeHandle() = default;
61 
62  template <typename U>
63  bool operator==(const TypedAttributeHandle<U>& o) const
64  {
65  return std::is_same_v<T, U> && m_base_handle == o.m_base_handle &&
67  }
68  bool operator<(const TypedAttributeHandle<T>& o) const;
69  bool is_valid() const { return m_base_handle.is_valid(); }
71  const AttributeHandle& base_handle() const { return m_base_handle; }
72  operator std::string() const;
73 };
74 } // namespace attribute
75 template <typename T>
77 } // namespace wmtk
A CachingAccessor that uses tuples for accessing attributes instead of indices.
Definition: Accessor.hpp:25
Internal handle representation used by MeshAttributes.
Contains all attributes of type T for a single mesh.
Handle that represents attributes for some mesh.
bool operator==(const TypedAttributeHandle< U > &o) const
bool operator<(const TypedAttributeHandle< T > &o) const
TypedAttributeHandle(AttributeHandle ah, PrimitiveType pt)
const AttributeHandle & base_handle() const
TypedAttributeHandle & operator=(const TypedAttributeHandle &)=default
TypedAttributeHandle(TypedAttributeHandle &&)=default
TypedAttributeHandle & operator=(TypedAttributeHandle &&)=default
TypedAttributeHandle(int64_t index, PrimitiveType pt)
TypedAttributeHandle(const TypedAttributeHandle &)=default
wmtk::attribute::AttributeHandle m_base_handle
Definition: Accessor.hpp:6