Entity.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5// Base Class
6#include "EntitySnapshot.h"
7#include "detail/EntityBase.h"
8
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>
16 {
17 public:
18 Entity(const std::string& exportName,
19 const MemoryID& memoryId,
20 const std::shared_ptr<Processors>& filters,
21 const std::shared_ptr<persistence::MemoryPersistenceStrategy>& persistenceStrategy);
22
23 protected:
24 // Implementation methods
25 bool _implHasSnapshot(const Time& snapshotTime) const override;
26
27 bool _implForEachSnapshot(std::function<void(EntitySnapshot&)> func) const override;
29 long last,
30 std::function<void(EntitySnapshot&)> func) const override;
32 const Time& max,
33 std::function<void(EntitySnapshot&)> func) const override;
34 bool _implForEachSnapshotBeforeOrAt(const Time& time,
35 std::function<void(EntitySnapshot&)> func) const override;
36 bool _implForEachSnapshotBefore(const Time& time,
37 std::function<void(EntitySnapshot&)> func) const override;
39 std::function<bool(EntitySnapshot&)> func) const override;
40
41 std::shared_ptr<EntitySnapshot> _implFindSnapshot(const Time& snapshotTime) const override;
42 std::shared_ptr<EntitySnapshot> _implFindLatestSnapshot() const override;
43 std::shared_ptr<EntitySnapshot> _implFindLatestSnapshotBefore(const Time& time) const override;
44 std::shared_ptr<EntitySnapshot>
45 _implFindLatestSnapshotBeforeOrAt(const Time& time) const override;
46 std::shared_ptr<EntitySnapshot> _implFindFirstSnapshotAfter(const Time& time) const override;
47 std::shared_ptr<EntitySnapshot> _implFindFirstSnapshotAfterOrAt(const Time& time) const override;
48
49 void _loadAllReferences(armem::wm::Entity& wmEntity) override;
50 void _loadLatestNReferences(int n, armem::wm::Entity& wmEntity) override;
51 void _resolve(armem::wm::Entity& wmEntity) override;
52 void _store(const armem::wm::Entity& wmEntity, bool simulatedVersion) override;
53
54 private:
55 std::shared_ptr<persistence::MemoryPersistenceStrategy> persistenceStrategy_;
56 };
57
58} // namespace armarx::armem::server::ltm
bool _implForEachSnapshotBeforeReverse(const Time &time, std::function< bool(EntitySnapshot &)> func) const override
Definition Entity.cpp:144
bool _implForEachSnapshotInTimeRange(const Time &min, const Time &max, std::function< void(EntitySnapshot &)> func) const override
Definition Entity.cpp:90
bool _implHasSnapshot(const Time &snapshotTime) const override
Definition Entity.cpp:186
bool _implForEachSnapshotInIndexRange(long first, long last, std::function< void(EntitySnapshot &)> func) const override
Definition Entity.cpp:57
bool _implForEachSnapshot(std::function< void(EntitySnapshot &)> func) const override
Definition Entity.cpp:27
bool _implForEachSnapshotBefore(const Time &time, std::function< void(EntitySnapshot &)> func) const override
Definition Entity.cpp:127
std::shared_ptr< EntitySnapshot > _implFindLatestSnapshot() const override
Definition Entity.cpp:215
bool _implForEachSnapshotBeforeOrAt(const Time &time, std::function< void(EntitySnapshot &)> func) const override
Definition Entity.cpp:109
void _store(const armem::wm::Entity &wmEntity, bool simulatedVersion) override
Definition Entity.cpp:458
std::shared_ptr< EntitySnapshot > _implFindFirstSnapshotAfterOrAt(const Time &time) const override
Definition Entity.cpp:343
void _resolve(armem::wm::Entity &wmEntity) override
Definition Entity.cpp:434
std::shared_ptr< EntitySnapshot > _implFindFirstSnapshotAfter(const Time &time) const override
Definition Entity.cpp:312
void _loadLatestNReferences(int n, armem::wm::Entity &wmEntity) override
Definition Entity.cpp:394
Entity(const std::string &exportName, const MemoryID &memoryId, const std::shared_ptr< Processors > &filters, const std::shared_ptr< persistence::MemoryPersistenceStrategy > &persistenceStrategy)
Definition Entity.cpp:20
void _loadAllReferences(armem::wm::Entity &wmEntity) override
Definition Entity.cpp:373
std::shared_ptr< EntitySnapshot > _implFindLatestSnapshotBefore(const Time &time) const override
Definition Entity.cpp:248
std::shared_ptr< EntitySnapshot > _implFindSnapshot(const Time &snapshotTime) const override
Definition Entity.cpp:199
std::shared_ptr< EntitySnapshot > _implFindLatestSnapshotBeforeOrAt(const Time &time) const override
Definition Entity.cpp:281
Interface functions for the longterm memory classes.
Definition EntityBase.h:18
Client-side working memory entity.
armarx::core::time::DateTime Time
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)