Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
server_context_dtl.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
22#include <utility>
23
25{
26
27// Types.
28
29/**
30 * This is the `friend` facade of Server_context that exposes the internal-use `private` API, so that only internal
31 * code (Context_server) can, e.g., construct a Server_context. (The user receives an already-constructed
32 * Server_context via `Context_server::accept()` but cannot construct one themselves.)
33 *
34 * @see Server_context doc header.
35 */
37{
38 // Methods.
39
40 /**
41 * Constructs a Server_context in PEER state, in the heap, returning the owning handle; forwards args to
42 * the `private` Server_context ctor.
43 *
44 * @tparam Server_context_t
45 * The concrete Server_context type to construct. (Not deducible; specify explicitly.)
46 * @tparam Ctor_args
47 * See above.
48 * @param ctor_args
49 * see above.
50 * @return Handle to the newly constructed Server_context.
51 */
52 template<typename Server_context_t, typename... Ctor_args>
53 static typename Server_context_t::Ptr ct_base(Ctor_args&&... ctor_args);
54}; // struct Server_context_dtl
55
56// Template implementations.
57
58template<typename Server_context_t, typename... Ctor_args>
59typename Server_context_t::Ptr Server_context_dtl::ct_base(Ctor_args&&... ctor_args) // Static.
60{
61 // Perf doesn't matter here; plus make_unique<>() cannot access the private ctor, being a non-friend.
62 return typename Server_context_t::Ptr{new Server_context_t{std::forward<Ctor_args>(ctor_args)...}};
63}
64
65} // namespace ipc::transport::struc::shm::rpc
Provides Flow-IPC's integration with Cap'n Proto's Remote Procedure Call (RPC) layer,...
This is the friend facade of Server_context that exposes the internal-use private API,...
static Server_context_t::Ptr ct_base(Ctor_args &&... ctor_args)
Constructs a Server_context in PEER state, in the heap, returning the owning handle; forwards args to...