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