Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
server_session_dtl.hpp
Go to the documentation of this file.
1/* Flow-IPC: Sessions
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
24namespace ipc::session
25{
26
27// Types.
28
29/**
30 * This is the `friend` facade of Server_session or any more-advanced (e.g., SHM-capable) variant thereof
31 * that exposes `private` APIs hidden from public user by providing public access to them; this is used internally
32 * by Session_server. The background is briefly explained in the impl section of Server_session doc header.
33 *
34 * @tparam Base_t
35 * The type of object whose specific `private` API to expose.
36 */
37template<typename Base_t>
39{
40 // Types.
41
42 /// Short-hand for wrapped class.
43 using Base = Base_t;
44
45 /// See #Base counterpart.
46 using Session_base_obj = typename Base::Session_base_obj;
47
48 // Data.
49
50 /// Direct-initializable wrapped object. Access `public` API through this reference; `private` API via `*this`.
52
53 // Methods.
54
55 /**
56 * Forwards to #Base ctor(s).
57 * @param ctor_args
58 * See above.
59 * @return New #Base.
60 */
61 template<typename... Ctor_args>
62 static auto ct_base(Ctor_args&&... ctor_args) -> Base;
63 // @todo See definition for reason for the odd --^-- signature form (Doxygen).
64
65 /**
66 * See #Base counterpart.
67 * @param args
68 * See above.
69 */
70 template<typename... Args>
71 void async_accept_log_in(Args&&... args);
72
73 /**
74 * See #Base counterpart.
75 * @return See above.
76 */
77 const Session_base_obj& base() const;
78}; // struct Server_session_dtl
79
80// Template implementations.
81
82template<typename Base_t>
83template<typename... Ctor_args>
84auto Server_session_dtl<Base_t>::ct_base(Ctor_args&&... ctor_args) -> Base_t
85// Doxygen 1.9.4 gets confused here otherwise; the `->` form is a work-around for that. @todo Revisit with later ver.
86{
87 // Out of abundance of caution: Avoid initializer-list pitfalls in this generic code: (), not {} here.
88 return Base(std::forward<Ctor_args>(ctor_args)...);
89}
90
91template<typename Base_t>
92template<typename... Args>
94{
95 m_base.async_accept_log_in(std::forward<Args>(args)...);
96}
97
98template<typename Base_t>
101{
102 return m_base.base();
103}
104
105} // namespace ipc::session
Flow-IPC module providing the broad lifecycle and shared-resource organization – via the session conc...
Definition: app.cpp:29
This is the friend facade of Server_session or any more-advanced (e.g., SHM-capable) variant thereof ...
const Session_base_obj & base() const
See Base counterpart.
typename Base::Session_base_obj Session_base_obj
See Base counterpart.
Base & m_base
Direct-initializable wrapped object. Access public API through this reference; private API via *this.
static auto ct_base(Ctor_args &&... ctor_args) -> Base
Forwards to Base ctor(s).
void async_accept_log_in(Args &&... args)
See Base counterpart.
Base_t Base
Short-hand for wrapped class.