Wildmeshing Toolkit
Loading...
Searching...
No Matches
AttributeScope.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include "Attribute.hpp"
6#include "AttributeCache.hpp"
7
8namespace wmtk {
9
10
11namespace attribute {
12template <typename T, int Dim>
13class CachingAccessor;
14
15template <typename T>
17{
18public:
19 template <typename U, int D>
20 friend class CachingAccessor;
27 AttributeScope(std::unique_ptr<AttributeScope<T>>&& next);
28
29 using AttributeCache<T>::size;
30 // flushes cache to previous scope unless there is no previous scope, in which
31 // case it flushes data to the underlying attribute storage
32 void apply(Attribute<T>& attr) const;
33
34 void apply(const Attribute<T>& attr, std::vector<T>& data);
35
36private:
39
40 template <int Dim>
42 const;
43 template <int Dim>
44 T load_const_cached_scalar_value(const AccessorBase<T>& accessor, int64_t index) const;
45
46 AttributeCache<T>& get_cache() { return static_cast<AttributeCache<T>&>(*this); }
47};
48
49} // namespace attribute
50} // namespace wmtk
51#include "AttributeScope.hxx"
This class stores data of type T in a vector.
Definition Attribute.hpp:32
ConstMapResult load_const_cached_vector_value(const AccessorBase< T, Dim > &accessor, int64_t index) const
AttributeScope(AttributeScope &&)=default
AttributeScope & operator=(AttributeScope &&)=default
typename AttributeCache< T >::MapResult MapResult
typename AttributeCache< T >::ConstMapResult ConstMapResult
AttributeScope & operator=(const AttributeScope &)=delete
AttributeScope(const AttributeScope &)=delete
AttributeCache< T > & get_cache()
AttributeScope(std::unique_ptr< AttributeScope< T > > &&next)
T load_const_cached_scalar_value(const AccessorBase< T > &accessor, int64_t index) const
void apply(Attribute< T > &attr) const
An accessor for cached attribute values.