rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
program_cache.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include "program_cache_key.hpp"
6
7#include <rexlib/core/platform/dynamic_shared_object.h>
8
9#include <cstddef>
10#include <functional>
11#include <memory>
12#include <typeindex>
13
14namespace rexlib
15{
16
42{
43public:
50 REXLIB_API
51 explicit program_cache(std::size_t capacity) noexcept;
52 program_cache(const program_cache &other) = delete;
53 program_cache(program_cache &&other) = delete;
54 REXLIB_API
56
58 operator=(const program_cache &other) = delete;
60 operator=(program_cache &&other) = delete;
61
67 REXLIB_API
68 std::size_t get_capacity() const noexcept;
69
83 REXLIB_API
84 std::shared_ptr<void> touch(const program_cache_key &key);
85
99 REXLIB_API
100 void store(
101 std::unique_ptr<const program_cache_key> key,
102 std::shared_ptr<void> value
103 );
104
105private:
106 class implementation;
107 std::unique_ptr<implementation> m_implementation;
108};
109
110} // namespace rexlib
Abstract base for keys stored in an program_cache.
Definition program_cache_key.hpp:16
Bounded associative store for backend-private resources reused across operation program builds.
Definition program_cache.hpp:42
void store(std::unique_ptr< const program_cache_key > key, std::shared_ptr< void > value)
Store a value under the given key, replacing any existing entry under a key of the same dynamic type ...
std::size_t get_capacity() const noexcept
Get the maximum number of entries this cache may hold.
std::shared_ptr< void > touch(const program_cache_key &key)
Look up a previously stored value and grant it amnesty.
program_cache(std::size_t capacity) noexcept
Construct a cache with the given capacity.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10