Sen API
Sen Libraries
Loading...
Searching...
No Matches
subscription.h
Go to the documentation of this file.
1// === subscription.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_SUBSCRIPTION_H
9#define SEN_CORE_OBJ_SUBSCRIPTION_H
10
11// sen
14
15namespace sen
16{
17
20
22template <typename T>
24{
25public:
26 SEN_COPY_CONSTRUCT(Subscription) = delete;
27 SEN_COPY_ASSIGN(Subscription) = delete;
28
29public: // special members
30 Subscription(Subscription&& other) noexcept;
32 Subscription() = default;
34
35public:
36 ObjectList<T> list; // NOLINT(misc-non-private-member-variables-in-classes)
37 std::shared_ptr<ObjectSource> source; // NOLINT(misc-non-private-member-variables-in-classes)
38};
39
40//-------------------------------------------------------------------------------------------------------------------
41// Inline implementation
42//-------------------------------------------------------------------------------------------------------------------
43
44template <typename T>
46 : list(std::move(other.list)), source(std::move(other.source))
47{
48 other.source = {};
49}
50
51template <typename T>
53{
54 list = std::move(other.list);
55 source = other.source;
56 other.source.reset();
57}
58
59template <typename T>
61{
62 if (source)
63 {
64 source->removeSubscriber(&list, true);
65 }
66}
67
69
70} // namespace sen
71
72#endif // SEN_CORE_OBJ_SUBSCRIPTION_H
A list of objects that is managed by some source based on user-expressed interests.
Definition object_list.h:29
Subscription & operator=(Subscription &&other) noexcept
Definition subscription.h:52
~Subscription()
Definition subscription.h:60
Subscription(Subscription &&other) noexcept
Definition subscription.h:45
Definition assert.h:17
Subscription()=default
std::shared_ptr< ObjectSource > source
Definition subscription.h:37
ObjectList< T > list
Definition subscription.h:36