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}
49
50template <typename T>
52{
53 if (this != &other)
54 {
55 if (source)
56 {
57 source->removeSubscriber(&list, true);
58 }
59
60 list = std::move(other.list);
61 source = std::move(other.source);
62 }
63
64 return *this;
65}
66
67template <typename T>
69{
70 if (source)
71 {
72 source->removeSubscriber(&list, true);
73 }
74}
75
77
78} // namespace sen
79
80#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:51
~Subscription()
Definition subscription.h:68
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