EntityInstanceBase.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 
5 // BaseClass
9 
10 #include "MemoryItem.h"
11 
13 {
14  /// @brief Interface functions for the longterm memory classes
16  {
17  public:
18  struct Statistics
19  {
20  long recordedData = 0;
21  long recordedMetaData = 0;
22  };
23 
24  public:
26 
27  /// return the full sub-ltm as a wm::EntitySnapshot with only references
28  /// the ltm may be huge, use with caution
29  void
31  {
33  }
34 
35  /// convert the references of the input into a wm::Memory
36  void
38  {
39  _resolve(e);
40  }
41 
42  /// encode the content of a wm::Memory and store
43  nlohmann::json
45  {
46  return _store(e);
47  }
48 
49  /// statistics
50  void
52  {
55  }
56 
57  Statistics
58  getStatistics() const
59  {
60  return statistics;
61  }
62 
63  static std::string getLevelName();
64 
65  protected:
66  virtual void _loadAllReferences(armem::wm::EntitySnapshot&) const = 0;
67  virtual void _resolve(armem::wm::EntityInstance&) const = 0;
68  virtual nlohmann::json _store(const armem::wm::EntityInstance&) = 0;
69 
70  protected:
71  mutable std::recursive_mutex ltm_mutex;
72 
74  };
75 } // namespace armarx::armem::server::ltm::detail
armarx::armem::server::ltm::detail
Definition: CoreSegmentBase.cpp:3
armarx::armem::server::ltm::detail::EntityInstanceBase
Interface functions for the longterm memory classes.
Definition: EntityInstanceBase.h:15
armarx::armem::server::ltm::detail::EntityInstanceBase::Statistics
Definition: EntityInstanceBase.h:18
armarx::armem::server::ltm::detail::EntityInstanceBase::_loadAllReferences
virtual void _loadAllReferences(armem::wm::EntitySnapshot &) const =0
armarx::armem::wm::EntityInstance
Client-side working entity instance.
Definition: memory_definitions.h:32
armarx::armem::server::ltm::detail::EntityInstanceBase::_resolve
virtual void _resolve(armem::wm::EntityInstance &) const =0
MemoryID.h
armarx::armem::server::ltm::detail::EntityInstanceBase::resetStatistics
void resetStatistics()
statistics
Definition: EntityInstanceBase.h:51
armarx::armem::server::ltm::detail::EntityInstanceBase::getStatistics
Statistics getStatistics() const
Definition: EntityInstanceBase.h:58
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::EntityInstanceBase::_store
virtual nlohmann::json _store(const armem::wm::EntityInstance &)=0
armarx::armem::server::ltm::detail::EntityInstanceBase::ltm_mutex
std::recursive_mutex ltm_mutex
Definition: EntityInstanceBase.h:71
armarx::armem::server::ltm::detail::EntityInstanceBase::Statistics::recordedData
long recordedData
Definition: EntityInstanceBase.h:20
armarx::armem::server::ltm::detail::EntityInstanceBase::store
nlohmann::json store(const armem::wm::EntityInstance &e)
encode the content of a wm::Memory and store
Definition: EntityInstanceBase.h:44
armarx::armem::wm::EntitySnapshot
Client-side working memory entity snapshot.
Definition: memory_definitions.h:80
memory_definitions.h
armarx::armem::server::ltm::detail::EntityInstanceBase::resolve
void resolve(armem::wm::EntityInstance &e) const
convert the references of the input into a wm::Memory
Definition: EntityInstanceBase.h:37
armarx::armem::server::ltm::detail::EntityInstanceBase::Statistics::recordedMetaData
long recordedMetaData
Definition: EntityInstanceBase.h:21
armarx::armem::server::ltm::detail::EntityInstanceBase::statistics
Statistics statistics
Definition: EntityInstanceBase.h:73
armarx::armem::server::ltm::detail::MemoryItem
Interface functions for the longterm memory classes.
Definition: MemoryItem.h:13
MemoryItem.h
armarx::armem::server::ltm::detail::EntityInstanceBase::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: EntityInstanceBase.h:30
armarx::armem::server::ltm::detail::EntityInstanceBase::getLevelName
static std::string getLevelName()
Definition: EntityInstanceBase.cpp:11