Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
connection_guard.h
Go to the documentation of this file.
1
// === connection_guard.h ==============================================================================================
2
// Sen Infrastructure
3
// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4
// See the LICENSE.txt file for more information.
5
// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6
// =====================================================================================================================
7
8
#ifndef SEN_CORE_OBJ_CONNECTION_GUARD_H
9
#define SEN_CORE_OBJ_CONNECTION_GUARD_H
10
11
// sen
12
#include "
sen/core/base/compiler_macros.h
"
13
#include "
sen/core/meta/type.h
"
14
15
// std
16
#include <cstdint>
17
#include <memory>
18
19
namespace
sen
20
{
21
22
namespace
impl
23
{
24
25
template
<
typename
... T>
26
class
EventBuffer;
27
28
}
29
32
33
class
Object
;
34
36
class
[[nodiscard]]
ConnectionGuard
37
{
38
public
:
39
SEN_COPY_CONSTRUCT(
ConnectionGuard
) =
delete
;
40
SEN_COPY_ASSIGN(
ConnectionGuard
) =
delete
;
41
42
public
:
43
SEN_MOVE_CONSTRUCT(
ConnectionGuard
);
44
SEN_MOVE_ASSIGN(
ConnectionGuard
);
45
46
public
:
48
ConnectionGuard
();
49
52
~ConnectionGuard
();
53
55
void
keep
() noexcept;
56
57
private:
58
friend class
Object
;
59
60
template <typename... T>
61
friend class impl::
EventBuffer
;
62
64
ConnectionGuard
(
Object
* source, uint32_t
id
,
MemberHash
memberHash,
bool
typed);
65
67
void
destroy();
68
69
private:
70
std
::weak_ptr<
Object
> source_;
71
uint32_t id_;
72
MemberHash
memberHash_;
73
bool
typed_;
74
};
75
77
78
}
// namespace sen
79
80
#endif
// SEN_CORE_OBJ_CONNECTION_GUARD_H
sen::ConnectionGuard::Object
friend class Object
Definition
connection_guard.h:58
sen::ConnectionGuard::~ConnectionGuard
~ConnectionGuard()
Removes the associated callback from the object if the object has not been destructed and keep() has ...
sen::ConnectionGuard::ConnectionGuard
ConnectionGuard()
Constructs an emtpy guard.
sen::ConnectionGuard::keep
void keep() noexcept
Tells this class to keep the callback even when this guard is destroyed.
sen::ConnectionGuard::EventBuffer
friend class impl::EventBuffer
Definition
connection_guard.h:61
sen::Object
A sen object.
Definition
object.h:76
compiler_macros.h
sen
Definition
assert.h:17
std
STL namespace.
sen::MemberHash
The hash of a member.
Definition
type.h:39
type.h
libs
core
include
sen
core
obj
connection_guard.h
Generated by
1.17.0