6#include <unordered_map>
10#include <RobotAPI/interface/armem/client/MemoryListenerInterface.h>
31 const std::vector<MemoryID>& updatedSnapshotIDs)>;
33 std::function<void(
const std::vector<MemoryID>& updatedSnapshotIDs)>;
35 template <
class CalleeT>
37 const std::vector<MemoryID>& updatedSnapshotIDs);
38 template <
class CalleeT>
40 void (CalleeT::*)(
const std::vector<MemoryID>& updatedSnapshotIDs);
59 template <
class CalleeT>
63 auto cb = [callee, callback](
const MemoryID& subscriptionID,
64 const std::vector<MemoryID>& updatedSnapshotIDs)
65 { (callee->*callback)(subscriptionID, updatedSnapshotIDs); };
69 template <
class CalleeT>
76 [callee, callback](
const MemoryID&,
const std::vector<MemoryID>& updatedSnapshotIDs)
80 (callee->*callback)(updatedSnapshotIDs);
89 void updated(
const std::vector<MemoryID>& updatedIDs)
const;
90 void updated(
const std::vector<data::MemoryID>& updatedIDs)
const;
103 std::unordered_map<MemoryID, std::vector<ManagedCallback>>
callbacks;
The ManagedIceObject is the base class for all ArmarX objects.
void(CalleeT::*)(const MemoryID &subscriptionID, const std::vector< MemoryID > &updatedSnapshotIDs) MemberCallback
void unsubscribe(SubscriptionHandle &subscriptionHandle)
void updated(const std::vector< MemoryID > &updatedIDs) const
Function handling updates from the MemoryListener ice topic.
std::mutex subscribeMutex
std::unordered_map< MemoryID, std::vector< ManagedCallback > > callbacks
SubscriptionHandle subscribe(const MemoryID &subscriptionID, CalleeT *callee, MemberCallbackUpdatedOnly< CalleeT > callback)
SubscriptionHandle subscribe(const MemoryID &subscriptionID, Callback Callback)
MemoryListener(ManagedIceObject *component=nullptr)
std::unordered_map< std::string, int > memoryRefCount
memoryName -> callbacks needing memory topic
SubscriptionHandle subscribe(const MemoryID &subscriptionID, CalleeT *callee, MemberCallback< CalleeT > callback)
Subscribe with a class member function:
std::function< void(const MemoryID &subscriptionID, const std::vector< MemoryID > &updatedSnapshotIDs)> Callback
void(CalleeT::*)(const std::vector< MemoryID > &updatedSnapshotIDs) MemberCallbackUpdatedOnly
std::function< void(const std::vector< MemoryID > &updatedSnapshotIDs)> CallbackUpdatedOnly
static std::string MakeMemoryTopicName(const MemoryID &memoryID)
void setComponent(ManagedIceObject *component)
This file offers overloads of toIce() and fromIce() functions for STL container types.