SubscriptionHandle.cpp
Go to the documentation of this file.
2
5
6#include "MemoryListener.h"
7
9{
11 const MemoryID& memoryID,
12 long id) :
13 valid{true}, memoryListener{memoryListener}, memoryID(memoryID), id{id}
14 {
15 }
16
18 {
19 }
20
22 valid{other.valid},
23 memoryListener{other.memoryListener},
24 memoryID(std::move(other.memoryID)),
25 id{other.id}
26 {
27 other.valid = false;
28 }
29
32 {
33 swap(*this, other);
34 return *this;
35 }
36
37 void
39 {
40 if (memoryListener != nullptr)
41 {
42 memoryListener->unsubscribe(*this);
43 }
44 }
45
49
51 handle(std::move(handle))
52 {
53 }
54
57 {
58 std::swap(this->handle, handle);
59 return *this;
60 }
61
63 {
64 ARMARX_INFO << "Releasing handle";
65 handle.release();
66 }
67
68} // namespace armarx::armem::client::util
69
71{
72 void
74 {
75 std::swap(first.valid, second.valid);
76 std::swap(first.memoryListener, second.memoryListener);
77 std::swap(first.memoryID, second.memoryID);
78 std::swap(first.id, second.id);
79 }
80} // namespace armarx::armem::client
Handles update signals from the memory system and distributes it to its subsribers.
ScopedSubscriptionHandle & operator=(SubscriptionHandle handle)
Assignment operator.
friend void swap(SubscriptionHandle &first, SubscriptionHandle &second)
SubscriptionHandle & operator=(SubscriptionHandle other)
Assignment operator.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
void swap(SubscriptionHandle &first, SubscriptionHandle &second)
This file is part of ArmarX.
const MemoryID memoryID