tatami_chunked
Helpers to create custom chunked tatami matrices
Loading...
Searching...
No Matches
DenseSlabFactory.hpp
Go to the documentation of this file.
1#ifndef TATAMI_CHUNKED_DENSE_SLAB_FACTORY_HPP
2#define TATAMI_CHUNKED_DENSE_SLAB_FACTORY_HPP
3
4#include <vector>
5#include "SlabCacheStats.hpp"
6
12namespace tatami_chunked {
13
24template<typename Value_>
30 DenseSlabFactory(size_t slab_size, size_t max_slabs) : my_slab_size(slab_size), my_pool(max_slabs * slab_size) {}
31
35 DenseSlabFactory(const SlabCacheStats& stats) : DenseSlabFactory(stats.slab_size_in_elements, stats.max_slabs_in_cache) {}
36
40 // Delete the copy constructors as we're passing out pointers.
41 DenseSlabFactory(const DenseSlabFactory&) = delete;
42 DenseSlabFactory& operator=(const DenseSlabFactory&) = delete;
43
44 // Move constructors are okay though.
46 DenseSlabFactory& operator=(DenseSlabFactory&&) = default;
51private:
52 size_t my_offset = 0, my_slab_size;
53 std::vector<Value_> my_pool;
54
55public:
59 struct Slab {
64 };
65
74 output.data = my_pool.data() + my_offset;
75 my_offset += my_slab_size;
76 return output;
77 }
78};
79
80}
81
82#endif
Slab cache statistics.
Methods to handle chunked tatami matrices.
Definition ChunkDimensionStats.hpp:4
Statistics for regular chunks along a dimension.
Definition ChunkDimensionStats.hpp:35
Dense slab.
Definition DenseSlabFactory.hpp:59
Value_ * data
Definition DenseSlabFactory.hpp:63
Factory for dense slabs.
Definition DenseSlabFactory.hpp:25
DenseSlabFactory(size_t slab_size, size_t max_slabs)
Definition DenseSlabFactory.hpp:30
DenseSlabFactory(const SlabCacheStats &stats)
Definition DenseSlabFactory.hpp:35
Slab create()
Definition DenseSlabFactory.hpp:72
Statistics for slab caching.
Definition SlabCacheStats.hpp:20