Flow-IPC 1.0.1
Flow-IPC project: Full implementation reference.
shm.hpp
Go to the documentation of this file.
1/* Flow-IPC: Shared Memory
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19#pragma once
20
21// (See shm_fwd.hpp for doc header for this namespace.)
22namespace ipc::shm
23{
24
25// Types.
26
27/**
28 * Implementation of #Arena_to_borrower_allocator_arena_t. See specializations which actually contain the mapping for
29 * specific `Arena` types; for example: `Arena_to_shm_session<classic::Pool_arena>`,
30 * `Arena_to_shm_session<arena_lend::jemalloc::Ipc_arena>`.
31 */
32template<typename Arena>
34{
35 /// Implementation of #Arena_to_borrower_allocator_arena_t. There is no default mapping; see specializations.
36 using Type = void;
37};
38
39/**
40 * Alias that, given an `Arena` type (with `Arena::construct<T>()` which allocates/constructs a `T`), yields a
41 * `Borrower_allocator_arena` type which can be used as the `Arena` arg to stl::Stateless_allocator for the
42 * borrower-side counterpart `T`, usable in `Shm_session::borrow_object<T>()` to recover so-constructed
43 * objects.
44 *
45 * Informally, for informational convenience:
46 * - Arena-sharing SHM-providers (classic::Pool_arena as of this writing), by definition, are symmetric, where
47 * each side can both lend and borrow, allocate and write within the same `Arena`. Hence they will
48 * map `Arena` to itself.
49 * - Arena-lending SHM-providers (arena_lend::jemalloc as of this writing), by definition, are asymmetric;
50 * the borrowing side can only read, not allocate. Hence they will map `Arena` to a different borrower-arena
51 * type only whose `Pointer` *type* member shall be used.
52 *
53 * @tparam Arena
54 * SHM arena type that has method of the form `shared_ptr<T> construct<T>(...)`.
55 */
56template<typename Arena>
58
59} // namespace ipc::shm
Modules for SHared Memory (SHM) support.
Definition: classic.hpp:26
typename Arena_to_borrower_allocator_arena< Arena >::Type Arena_to_borrower_allocator_arena_t
Alias that, given an Arena type (with Arena::construct<T>() which allocates/constructs a T),...
Definition: shm.hpp:57
Implementation of Arena_to_borrower_allocator_arena_t.
Definition: shm.hpp:34
void Type
Implementation of Arena_to_borrower_allocator_arena_t. There is no default mapping; see specializatio...
Definition: shm.hpp:36