|
Handles update signals from the memory system and distributes it to its subsribers. More...
#include <RobotAPI/libraries/armem/client/util/MemoryListener.h>
Classes | |
struct | ManagedCallback |
Public Types | |
using | Callback = std::function< void(const MemoryID &subscriptionID, const std::vector< MemoryID > &updatedSnapshotIDs)> |
using | CallbackUpdatedOnly = std::function< void(const std::vector< MemoryID > &updatedSnapshotIDs)> |
template<class CalleeT > | |
using | MemberCallback = void(CalleeT::*)(const MemoryID &subscriptionID, const std::vector< MemoryID > &updatedSnapshotIDs) |
template<class CalleeT > | |
using | MemberCallbackUpdatedOnly = void(CalleeT::*)(const std::vector< MemoryID > &updatedSnapshotIDs) |
Public Member Functions | |
MemoryListener (ManagedIceObject *component=nullptr) | |
void | setComponent (ManagedIceObject *component) |
SubscriptionHandle | subscribe (const MemoryID &subscriptionID, Callback Callback) |
SubscriptionHandle | subscribe (const MemoryID &subscriptionID, CallbackUpdatedOnly Callback) |
template<class CalleeT > | |
SubscriptionHandle | subscribe (const MemoryID &subscriptionID, CalleeT *callee, MemberCallback< CalleeT > callback) |
Subscribe with a class member function: More... | |
template<class CalleeT > | |
SubscriptionHandle | subscribe (const MemoryID &subscriptionID, CalleeT *callee, MemberCallbackUpdatedOnly< CalleeT > callback) |
void | unsubscribe (SubscriptionHandle &subscriptionHandle) |
void | updated (const std::vector< data::MemoryID > &updatedIDs) const |
void | updated (const std::vector< MemoryID > &updatedIDs) const |
Function handling updates from the MemoryListener ice topic. More... | |
Static Public Member Functions | |
static std::string | MakeMemoryTopicName (const MemoryID &memoryID) |
Protected Attributes | |
std::unordered_map< MemoryID, std::vector< ManagedCallback > > | callbacks |
std::unordered_map< std::string, int > | memoryRefCount |
memoryName -> callbacks needing memory topic More... | |
long | nextId = 0 |
Handles update signals from the memory system and distributes it to its subsribers.
Definition at line 25 of file MemoryListener.h.
using Callback = std::function<void(const MemoryID& subscriptionID, const std::vector<MemoryID>& updatedSnapshotIDs)> |
Definition at line 30 of file MemoryListener.h.
using CallbackUpdatedOnly = std::function<void(const std::vector<MemoryID>& updatedSnapshotIDs)> |
Definition at line 32 of file MemoryListener.h.
using MemberCallback = void (CalleeT::*)(const MemoryID& subscriptionID, const std::vector<MemoryID>& updatedSnapshotIDs) |
Definition at line 36 of file MemoryListener.h.
using MemberCallbackUpdatedOnly = void (CalleeT::*)(const std::vector<MemoryID>& updatedSnapshotIDs) |
Definition at line 39 of file MemoryListener.h.
MemoryListener | ( | ManagedIceObject * | component = nullptr | ) |
Definition at line 22 of file MemoryListener.cpp.
|
static |
void setComponent | ( | ManagedIceObject * | component | ) |
SubscriptionHandle subscribe | ( | const MemoryID & | subscriptionID, |
Callback | Callback | ||
) |
Definition at line 116 of file MemoryListener.cpp.
SubscriptionHandle subscribe | ( | const MemoryID & | subscriptionID, |
CallbackUpdatedOnly | Callback | ||
) |
|
inline |
Subscribe with a class member function:
Definition at line 60 of file MemoryListener.h.
|
inline |
void unsubscribe | ( | SubscriptionHandle & | subscriptionHandle | ) |
Definition at line 144 of file MemoryListener.cpp.
void updated | ( | const std::vector< data::MemoryID > & | updatedIDs | ) | const |
void updated | ( | const std::vector< MemoryID > & | updatedIDs | ) | const |
Function handling updates from the MemoryListener ice topic.
Definition at line 41 of file MemoryListener.cpp.
|
protected |
Definition at line 101 of file MemoryListener.h.
|
protected |
memoryName -> callbacks needing memory topic
Definition at line 104 of file MemoryListener.h.
|
protected |
Definition at line 93 of file MemoryListener.h.