Entity.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 
5 // Base Class
6 #include "EntitySnapshot.h"
7 #include "detail/EntityBase.h"
10 
12 {
13  /// @brief A memory storing data in mongodb (needs 'armarx memory start' to start the mongod instance)
14  class Entity :
15  public detail::EntityBase<EntitySnapshot>,
18  {
19  public:
22  const std::string&,
23  const MemoryID& id,
24  const std::shared_ptr<Processors>&);
25 
26  bool hasSnapshot(const Time&) const override;
27 
28  bool forEachSnapshot(std::function<void(EntitySnapshot&)> func) const override;
29  bool forEachSnapshotInIndexRange(long first,
30  long last,
31  std::function<void(EntitySnapshot&)> func) const override;
33  const Time& max,
34  std::function<void(EntitySnapshot&)> func) const override;
35  bool forEachSnapshotBeforeOrAt(const Time& time,
36  std::function<void(EntitySnapshot&)> func) const override;
37  bool forEachSnapshotBefore(const Time& time,
38  std::function<void(EntitySnapshot&)> func) const override;
39 
40  std::shared_ptr<EntitySnapshot> findSnapshot(const Time&) const override;
41  std::shared_ptr<EntitySnapshot> findLatestSnapshot() const override;
42  std::shared_ptr<EntitySnapshot> findLatestSnapshotBefore(const Time& time) const override;
43  std::shared_ptr<EntitySnapshot>
44  findLatestSnapshotBeforeOrAt(const Time& time) const override;
45  std::shared_ptr<EntitySnapshot> findFirstSnapshotAfter(const Time& time) const override;
46  std::shared_ptr<EntitySnapshot> findFirstSnapshotAfterOrAt(const Time& time) const override;
47 
48  protected:
49  void _loadAllReferences(armem::wm::Entity&) override;
50  void _loadLatestNReferences(int n, armem::wm::Entity& e) override;
51  void _resolve(armem::wm::Entity&) override;
52  void _store(const armem::wm::Entity&) override;
53 
54  private:
55  };
56 
57 } // namespace armarx::armem::server::ltm
EntityBase.h
armarx::armem::server::ltm::Entity::forEachSnapshotBefore
bool forEachSnapshotBefore(const Time &time, std::function< void(EntitySnapshot &)> func) const override
Definition: Entity.cpp:162
MongoDBStorageMixin.h
armarx::armem::server::ltm::Entity::findLatestSnapshotBefore
std::shared_ptr< EntitySnapshot > findLatestSnapshotBefore(const Time &time) const override
Definition: Entity.cpp:235
armarx::armem::server::ltm::Entity::_resolve
void _resolve(armem::wm::Entity &) override
Definition: Entity.cpp:405
armarx::armem::server::ltm::Entity::_loadLatestNReferences
void _loadLatestNReferences(int n, armem::wm::Entity &e) override
Definition: Entity.cpp:367
armarx::armem::server::ltm::Entity::findFirstSnapshotAfterOrAt
std::shared_ptr< EntitySnapshot > findFirstSnapshotAfterOrAt(const Time &time) const override
Definition: Entity.cpp:319
armarx::armem::server::ltm::Entity
A memory storing data in mongodb (needs 'armarx memory start' to start the mongod instance)
Definition: Entity.h:14
armarx::max
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:267
armarx::armem::server::ltm::Entity::findFirstSnapshotAfter
std::shared_ptr< EntitySnapshot > findFirstSnapshotAfter(const Time &time) const override
Definition: Entity.cpp:291
armarx::armem::server::ltm::Entity::forEachSnapshot
bool forEachSnapshot(std::function< void(EntitySnapshot &)> func) const override
iterate over all entity snapshots of this ltm
Definition: Entity.cpp:38
armarx::armem::server::ltm::Entity::hasSnapshot
bool hasSnapshot(const Time &) const override
check if snapshot segment exists
Definition: Entity.cpp:178
armarx::armem::server::ltm::Entity::forEachSnapshotInTimeRange
bool forEachSnapshotInTimeRange(const Time &min, const Time &max, std::function< void(EntitySnapshot &)> func) const override
Definition: Entity.cpp:127
armarx::armem::server::ltm::Entity::findSnapshot
std::shared_ptr< EntitySnapshot > findSnapshot(const Time &) const override
find entity snapshot segment
Definition: Entity.cpp:195
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::server::ltm::Entity::forEachSnapshotBeforeOrAt
bool forEachSnapshotBeforeOrAt(const Time &time, std::function< void(EntitySnapshot &)> func) const override
Definition: Entity.cpp:145
armarx::armem::server::ltm::Entity::_store
void _store(const armem::wm::Entity &) override
Definition: Entity.cpp:426
armarx::armem::server::ltm::detail::mixin::MongoDBStorageMixin
Definition: MongoDBStorageMixin.h:45
armarx::armem::server::ltm::Entity::Entity
Entity(const detail::mixin::Path &, const detail::mixin::MongoDBSettings &, const std::string &, const MemoryID &id, const std::shared_ptr< Processors > &)
Definition: Entity.cpp:24
armarx::armem::server::ltm::Entity::_loadAllReferences
void _loadAllReferences(armem::wm::Entity &) override
Definition: Entity.cpp:347
EntitySnapshot.h
armarx::armem::server::ltm
Definition: forward_declarations.h:20
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::server::ltm::detail::EntityBase
Interface functions for the longterm memory classes.
Definition: EntityBase.h:17
armarx::armem::server::ltm::Entity::forEachSnapshotInIndexRange
bool forEachSnapshotInIndexRange(long first, long last, std::function< void(EntitySnapshot &)> func) const override
Definition: Entity.cpp:95
armarx::min
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:294
armarx::armem::server::ltm::Entity::findLatestSnapshot
std::shared_ptr< EntitySnapshot > findLatestSnapshot() const override
Definition: Entity.cpp:207
armarx::armem::server::ltm::Entity::findLatestSnapshotBeforeOrAt
std::shared_ptr< EntitySnapshot > findLatestSnapshotBeforeOrAt(const Time &time) const override
Definition: Entity.cpp:263
armarx::armem::server::ltm::detail::mixin::MongoDBSettings
Definition: MongoDBStorageMixin.h:15
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::armem::wm::Entity
Client-side working memory entity.
Definition: memory_definitions.h:93
armarx::armem::server::ltm::EntitySnapshot
Definition: EntitySnapshot.h:14
armarx::armem::server::ltm::detail::mixin::DiskMemoryItemMixin
Definition: DiskStorageMixin.h:19
DiskStorageMixin.h