EntitySnapshotBase.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 
5 // BaseClass
9 
10 #include "EntityBase.h"
11 #include "MemoryItem.h"
12 
14 {
15  /// @brief Interface functions for the longterm memory classes
16  template <class InstanceT>
18  {
19  public:
20  struct Statistics
21  {
23  };
24 
25  public:
27 
28  /// return the full sub-ltm as a wm::EntitySnapshot with only references
29  /// the ltm may be huge, use with caution
30  void
32  {
34  }
35 
36  /// convert the references of the input into a wm::Memory
37  void
39  {
40  _resolve(e);
41  }
42 
43  /// encode the content of a wm::Memory and store
44  void
46  {
47  _store(e);
48  }
49 
50  /// statistics
51  void
53  {
55  }
56 
57  Statistics
58  getStatistics() const
59  {
60  return statistics;
61  }
62 
63  static std::string
65  {
66  return "LT-EntitySnapshot";
67  }
68 
69  /// iterate over all Instance segments of this ltm
70  virtual bool forEachInstance(std::function<void(InstanceT&)> func) const = 0;
71 
72  /// check if Instance segment exists
73  virtual bool hasInstance(const int) const = 0;
74 
75  /// find Instance segment
76  virtual std::shared_ptr<InstanceT> findInstance(const int) const = 0;
77 
78  protected:
79  virtual void _loadAllReferences(armem::wm::EntitySnapshot&) const = 0;
80  virtual void _resolve(armem::wm::EntitySnapshot&) const = 0;
81  virtual void _store(const armem::wm::EntitySnapshot&) = 0;
82 
83  protected:
84  mutable std::recursive_mutex ltm_mutex;
85 
86  Statistics statistics;
87  };
88 } // namespace armarx::armem::server::ltm::detail
EntityBase.h
armarx::armem::server::ltm::detail::EntitySnapshotBase::forEachInstance
virtual bool forEachInstance(std::function< void(InstanceT &)> func) const =0
iterate over all Instance segments of this ltm
armarx::armem::server::ltm::detail
Definition: CoreSegmentBase.cpp:3
armarx::armem::server::ltm::detail::EntitySnapshotBase::_loadAllReferences
virtual void _loadAllReferences(armem::wm::EntitySnapshot &) const =0
MemoryID.h
armarx::armem::server::ltm::detail::EntitySnapshotBase::getLevelName
static std::string getLevelName()
Definition: EntitySnapshotBase.h:64
armarx::armem::server::ltm::detail::EntitySnapshotBase::loadAllReferences
void loadAllReferences(armem::wm::EntitySnapshot &e) const
return the full sub-ltm as a wm::EntitySnapshot with only references the ltm may be huge,...
Definition: EntitySnapshotBase.h:31
armarx::armem::server::ltm::detail::MemoryItem::MemoryItem
MemoryItem(const std::string &exportName, const MemoryID &)
Definition: MemoryItem.cpp:10
aron_conversions.h
armarx::armem::server::ltm::detail::EntitySnapshotBase::getStatistics
Statistics getStatistics() const
Definition: EntitySnapshotBase.h:58
armarx::armem::server::ltm::detail::EntitySnapshotBase
Interface functions for the longterm memory classes.
Definition: EntitySnapshotBase.h:17
armarx::armem::server::ltm::detail::EntitySnapshotBase::_store
virtual void _store(const armem::wm::EntitySnapshot &)=0
armarx::armem::server::ltm::detail::EntitySnapshotBase::findInstance
virtual std::shared_ptr< InstanceT > findInstance(const int) const =0
find Instance segment
armarx::armem::server::ltm::detail::EntitySnapshotBase::statistics
Statistics statistics
Definition: EntitySnapshotBase.h:86
armarx::armem::wm::EntitySnapshot
Client-side working memory entity snapshot.
Definition: memory_definitions.h:80
armarx::armem::server::ltm::detail::EntitySnapshotBase::resolve
void resolve(armem::wm::EntitySnapshot &e) const
convert the references of the input into a wm::Memory
Definition: EntitySnapshotBase.h:38
armarx::armem::server::ltm::detail::EntitySnapshotBase::ltm_mutex
std::recursive_mutex ltm_mutex
Definition: EntitySnapshotBase.h:84
memory_definitions.h
armarx::armem::server::ltm::detail::EntitySnapshotBase::Statistics
Definition: EntitySnapshotBase.h:20
armarx::armem::server::ltm::detail::EntitySnapshotBase::resetStatistics
void resetStatistics()
statistics
Definition: EntitySnapshotBase.h:52
armarx::armem::server::ltm::detail::EntitySnapshotBase::_resolve
virtual void _resolve(armem::wm::EntitySnapshot &) const =0
armarx::armem::server::ltm::detail::EntitySnapshotBase::hasInstance
virtual bool hasInstance(const int) const =0
check if Instance segment exists
armarx::armem::server::ltm::detail::EntitySnapshotBase::Statistics::recordedInstances
long recordedInstances
Definition: EntitySnapshotBase.h:22
armarx::armem::server::ltm::detail::MemoryItem
Interface functions for the longterm memory classes.
Definition: MemoryItem.h:13
MemoryItem.h
armarx::armem::server::ltm::detail::EntitySnapshotBase::store
void store(const armem::wm::EntitySnapshot &e)
encode the content of a wm::Memory and store
Definition: EntitySnapshotBase.h:45