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 ARMARX_CHECK_NOT_NULL(memoryListener);
41 memoryListener->unsubscribe(*this);
42 }
43
47
49 handle(std::move(handle))
50 {
51 }
52
55 {
56 std::swap(this->handle, handle);
57 return *this;
58 }
59
61 {
62 ARMARX_INFO << "Releasing handle";
63 handle.release();
64 }
65
66} // namespace armarx::armem::client::util
67
69{
70 void
72 {
73 std::swap(first.valid, second.valid);
74 std::swap(first.memoryListener, second.memoryListener);
75 std::swap(first.memoryID, second.memoryID);
76 std::swap(first.id, second.id);
77 }
78} // 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_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#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