SubscriptionHandle.h
Go to the documentation of this file.
1 #pragma once
2 
4 
6 {
7 
8  class MemoryListener;
9 
11  {
12  friend class MemoryListener;
13 
14  public:
17 
18  /**
19  * @brief Assignment operator.
20  *
21  * @note Intentional call by value, since this leverages the move constructor. See
22  * https://stackoverflow.com/a/11540204 (section "Move assignment operators").
23  */
25 
26  friend void swap(SubscriptionHandle& first, SubscriptionHandle& second);
27 
28  void release();
29 
30  private:
31  SubscriptionHandle(MemoryListener* memoryListener, const MemoryID& memoryID, long id);
32 
33  private:
34  bool valid = false;
35  MemoryListener* memoryListener = nullptr;
37  long id = 0;
38  };
39 
41  {
42  public:
45 
46  /**
47  * @brief Assignment operator.
48  *
49  * @note Intentional call by value, since this leverages the move constructor. See
50  * https://stackoverflow.com/a/11540204 (section "Move assignment operators").
51  */
53 
55 
56  private:
57  SubscriptionHandle handle;
58  };
59 
60  void swap(SubscriptionHandle& first, SubscriptionHandle& second);
61 
62 } // namespace armarx::armem::client::util
armarx::armem::client::util::SubscriptionHandle::operator=
SubscriptionHandle & operator=(SubscriptionHandle other)
Assignment operator.
Definition: SubscriptionHandle.cpp:28
armarx::armem::client::util::ScopedSubscriptionHandle::ScopedSubscriptionHandle
ScopedSubscriptionHandle()
Definition: SubscriptionHandle.cpp:40
MemoryID.h
armarx::armem::client::util::swap
void swap(SubscriptionHandle &first, SubscriptionHandle &second)
Definition: SubscriptionHandle.cpp:66
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::util::SubscriptionHandle
Definition: SubscriptionHandle.h:10
armarx::armem::client::util::ScopedSubscriptionHandle
Definition: SubscriptionHandle.h:40
armarx::armem::client::util::ScopedSubscriptionHandle::operator=
ScopedSubscriptionHandle & operator=(SubscriptionHandle handle)
Assignment operator.
Definition: SubscriptionHandle.cpp:50
armarx::armem::client::util::ScopedSubscriptionHandle::~ScopedSubscriptionHandle
~ScopedSubscriptionHandle()
Definition: SubscriptionHandle.cpp:56
armarx::armem::client::util::SubscriptionHandle::swap
friend void swap(SubscriptionHandle &first, SubscriptionHandle &second)
armarx::armem::client::util::MemoryListener
Handles update signals from the memory system and distributes it to its subsribers.
Definition: MemoryListener.h:25
armarx::armem::client::util::SubscriptionHandle::release
void release()
Definition: SubscriptionHandle.cpp:35
armarx::armem::index::memoryID
const MemoryID memoryID
Definition: memory_ids.cpp:29
armarx::armem::client::util
Definition: MemoryListener.cpp:13
armarx::armem::client::util::SubscriptionHandle::SubscriptionHandle
SubscriptionHandle()
Definition: SubscriptionHandle.cpp:14