Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
owner_spc_impl.hpp
Go to the documentation of this file.
1/* Flow-IPC: SHM-jemalloc
2 * Copyright (c) 2023 Akamai Technologies, Inc.; and other contributors.
3 * Each commit is copyright by its respective author or author's employer.
4 *
5 * Licensed under the MIT License:
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE. */
24
25/// @file
26#pragma once
27
28#include "ipc/shm/arena_lend/owner_shm_pool_collection.hpp"
29
31{
32
33/**
34 * This is the `friend` facade of Owner_shm_pool_collection that exposes non-public APIs hidden from public
35 * user by providing public access to them; this is used internally by various Flow-IPC components
36 * (Thread_lcl_obj_db_admin, `Shm_session`, etc.) that hold a pointer to an Owner_shm_pool_collection subclass
37 * and need access to a small privileged interface not intended for external users.
38 *
39 * @tparam Base_t
40 * The type of object whose specific non-public API to expose; an Owner_shm_pool_collection or subclass thereof.
41 */
42template<typename Base_t>
44{
45 // Types.
46
47 /// Short-hand for wrapped class.
48 using Base = Base_t;
49
50 // Data.
51
52 /// Direct-initializable wrapped object. Access `public` API through this reference; non-public API via `*this`.
54
55 // Methods.
56
57 /**
58 * See Owner_shm_pool_collection::generate_shm_object_name().
59 * @param shm_pool_id
60 * See Owner_shm_pool_collection counterpart.
61 * @return See Owner_shm_pool_collection counterpart.
62 */
64
65 /**
66 * See Owner_shm_pool_collection::get_pool_name_base().
67 * @return See Owner_shm_pool_collection counterpart.
68 */
69 const Shared_name& get_pool_name_base() const;
70
71 /// See eponymous method in #Base.
73}; // struct Owner_spc_impl
74
75// Template implementations.
76
77template<typename Base_t>
79{
80 return m_base.generate_shm_object_name(shm_pool_id);
81}
82
83template<typename Base_t>
85{
86 return m_base.get_pool_name_base();
87}
88
89template<typename Base_t>
91{
92 m_base.this_thread_ensure_tcache_exists();
93}
94
95} // namespace ipc::shm::arena_lend::detail
String-wrapping abstraction representing a name uniquely distinguishing a kernel-persistent entity fr...
Segregated private stuff for ipc::shm::arena_lend.
uint32_t pool_id_t
Pool ID type.
This is the friend facade of Owner_shm_pool_collection that exposes non-public APIs hidden from publi...
const Shared_name & get_pool_name_base() const
See Owner_shm_pool_collection::get_pool_name_base().
void this_thread_ensure_tcache_exists() const
See eponymous method in Base.
Base & m_base
Direct-initializable wrapped object. Access public API through this reference; non-public API via *th...
Shared_name generate_shm_object_name(Owner_shm_pool_collection::pool_id_t shm_pool_id) const
See Owner_shm_pool_collection::generate_shm_object_name().
Base_t Base
Short-hand for wrapped class.