Commit.h
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 #include <memory>
9 #include <vector>
10 
11 
12 namespace armarx::armem
13 {
14 
18  enum class UpdateType
19  {
22  };
23 
27  struct EntityUpdate
28  {
31 
33  std::vector<aron::data::DictPtr> instancesData;
34 
40 
41 
42  // OPTIONAL
43 
45  float confidence = 1.0;
46 
47 
48  // OPTIONAL
49 
56 
63 
64 
65  friend std::ostream& operator<<(std::ostream& os, const EntityUpdate& rhs);
66  };
67 
68 
73  {
74  bool success = false;
75 
78 
79  std::string errorMessage;
80 
81  friend std::ostream& operator<<(std::ostream& os, const EntityUpdateResult& rhs);
82  };
83 
84 
85 
89  struct Commit
90  {
97  std::vector<EntityUpdate> updates;
98 
99  EntityUpdate& add();
100  EntityUpdate& add(const EntityUpdate& update);
101  void add(const std::vector<EntityUpdate>& updates);
102  void append(const Commit& c);
103 
104  friend std::ostream& operator<<(std::ostream& os, const Commit& rhs);
105  };
106 
111  {
112  std::vector<EntityUpdateResult> results;
113 
114  bool allSuccess() const;
115  std::vector<std::string> allErrorMessages() const;
116 
117  friend std::ostream& operator<<(std::ostream& os, const CommitResult& rhs);
118  };
119 
120 
121 }
armarx::armem::CommitResult::allErrorMessages
std::vector< std::string > allErrorMessages() const
Definition: Commit.cpp:72
armarx::armem::EntityUpdateResult::operator<<
friend std::ostream & operator<<(std::ostream &os, const EntityUpdateResult &rhs)
Definition: Commit.cpp:23
armarx::armem::EntityUpdate::instancesData
std::vector< aron::data::DictPtr > instancesData
The entity data.
Definition: Commit.h:33
armarx::armem::Commit
A bundle of updates to be sent to the memory.
Definition: Commit.h:89
armarx::armem::EntityUpdate::timeArrived
Time timeArrived
Time when this update arrived at the memory server.
Definition: Commit.h:62
armarx::armem::EntityUpdateResult
Result of an EntityUpdate.
Definition: Commit.h:72
armarx::armem::EntityUpdate::timeCreated
Time timeCreated
Time when this entity update was created (e.g.
Definition: Commit.h:39
MemoryID.h
armarx::armem::EntityUpdate::confidence
float confidence
An optional confidence, may be used for things like decay.
Definition: Commit.h:45
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::EntityUpdate::timeSent
Time timeSent
Time when this update was sent to the memory server.
Definition: Commit.h:55
armarx::armem::Commit::operator<<
friend std::ostream & operator<<(std::ostream &os, const Commit &rhs)
Definition: Commit.cpp:34
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::armem::Commit::append
void append(const Commit &c)
Definition: Commit.cpp:99
armarx::armem::CommitResult::operator<<
friend std::ostream & operator<<(std::ostream &os, const CommitResult &rhs)
Definition: Commit.cpp:48
armarx::armem::UpdateType::UpdatedExisting
@ UpdatedExisting
armarx::armem::Commit::updates
std::vector< EntityUpdate > updates
The entity updates.
Definition: Commit.h:97
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:48
armarx::armem::UpdateType
UpdateType
The type of an update.
Definition: Commit.h:18
armarx::armem::EntityUpdate
An update of an entity for a specific point in time.
Definition: Commit.h:27
armarx::armem::CommitResult
Result of a Commit.
Definition: Commit.h:110
forward_declarations.h
armarx::armem::EntityUpdateResult::snapshotID
MemoryID snapshotID
Definition: Commit.h:76
armarx::armem::EntityUpdateResult::timeArrived
Time timeArrived
Definition: Commit.h:77
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::Commit::add
EntityUpdate & add()
Definition: Commit.cpp:81
armarx::armem::CommitResult::results
std::vector< EntityUpdateResult > results
Definition: Commit.h:112
armarx::armem::UpdateType::InsertedNew
@ InsertedNew
Time.h
armarx::armem::EntityUpdateResult::errorMessage
std::string errorMessage
Definition: Commit.h:79
armarx::armem::EntityUpdate::entityID
MemoryID entityID
The entity's ID.
Definition: Commit.h:30
armarx::armem::EntityUpdateResult::success
bool success
Definition: Commit.h:74
armarx::armem::CommitResult::allSuccess
bool allSuccess() const
Definition: Commit.cpp:64
armarx::core::time::DateTime::Invalid
static DateTime Invalid()
Definition: DateTime.cpp:60
armarx::armem::EntityUpdate::operator<<
friend std::ostream & operator<<(std::ostream &os, const EntityUpdate &rhs)
Definition: Commit.cpp:13