MemorySubscriber.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <mutex>
5 
7 
12 
15 
16 namespace armarx::armem::client
17 {
18  class MemoryNameSystem;
19 }
20 
22 {
23 
24  class MemorySubscriber : virtual public SimpleEventHandler
25  {
26 
27  public:
28  MemorySubscriber(const std::string& callerId, armem::client::MemoryNameSystem& mns);
29 
30  void handleEvent(const armem::wm::EntityInstance& memoryEntity);
31 
32  // Non-API.
33  public:
34  ~MemorySubscriber() override;
35 
36 
37  protected:
39 
40 
41  void onEntityUpdate(const std::vector<armem::MemoryID>& snapshotIDs);
42 
43  private:
44  const std::string callerId;
45  armem::client::MemoryNameSystem& memoryNameSystem;
46 
47  armem::Time lastMemoryPoll;
48 
49  armem::client::Reader memoryReader;
50 
51  std::mutex eventHandlingMtx;
52 
53  armem::MemoryID subscriptionID;
54  };
55 
56 } // namespace armarx::navigation::client
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
armarx::navigation::client::MemorySubscriber::~MemorySubscriber
~MemorySubscriber() override
Definition: MemorySubscriber.cpp:153
Reader.h
armarx::armem::wm::EntityInstance
Client-side working entity instance.
Definition: memory_definitions.h:32
armarx::navigation::client::SimpleEventHandler
Definition: SimpleEventHandler.h:12
MemoryID.h
armarx::navigation::client::MemorySubscriber::handleEvent
void handleEvent(const armem::wm::EntityInstance &memoryEntity)
Definition: MemorySubscriber.cpp:78
armarx::armem::client
This file is part of ArmarX.
Definition: forward_declarations.h:7
PeriodicTask.h
armarx::navigation::client::MemorySubscriber::MemorySubscriber
MemorySubscriber(const std::string &callerId, armem::client::MemoryNameSystem &mns)
Definition: MemorySubscriber.cpp:24
armarx::navigation::client
This file is part of ArmarX.
Definition: ComponentPlugin.cpp:20
EventSubscriptionInterface.h
armarx::memory
Brief description of class memory.
Definition: memory.h:39
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::navigation::client::MemorySubscriber::onEntityUpdate
void onEntityUpdate(const std::vector< armem::MemoryID > &snapshotIDs)
Definition: MemorySubscriber.cpp:46
armarx::armem::wm::Memory
Client-side working memory.
Definition: memory_definitions.h:133
SimpleEventHandler.h
armarx::navigation::client::MemorySubscriber
Definition: MemorySubscriber.h:24
memory_definitions.h
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
Time.h
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::navigation::client::MemorySubscriber::handleEvents
void handleEvents(const armem::wm::Memory &memory)
Definition: MemorySubscriber.cpp:165