memory_definitions.cpp
Go to the documentation of this file.
1 #include "memory_definitions.h"
2 
3 #include <map>
4 #include <vector>
5 
7 
9 
10 #include "error.h"
11 
12 namespace armarx::armem::wm
13 {
14 
15  bool
17  {
18  if (_data and other.data())
19  {
20  return id() == other.id() && _metadata == other.metadata() && *_data == *other.data();
21  }
22  if (_data or other.data())
23  {
24  return false;
25  }
26  return id() == other.id() && _metadata == other.metadata();
27  }
28 
29  void
31  {
32  ARMARX_CHECK_FITS_SIZE(this->index(), update.instancesData.size());
33 
34  this->data() = update.instancesData.at(size_t(this->index()));
35 
36  this->_metadata.confidence = update.confidence;
37 
39  this->_metadata.sentTime = update.sentTime;
40  this->_metadata.arrivedTime = update.arrivedTime;
41  }
42 
43 } // namespace armarx::armem::wm
armarx::armem::EntityUpdate::instancesData
std::vector< aron::data::DictPtr > instancesData
The entity data.
Definition: Commit.h:33
ARMARX_CHECK_FITS_SIZE
#define ARMARX_CHECK_FITS_SIZE(number, size)
Check whether number is nonnegative (>= 0) and less than size. If it is not, throw an ExpressionExcep...
Definition: ExpressionException.h:159
armarx::armem::wm::EntityInstance
Client-side working entity instance.
Definition: memory_definitions.h:32
armarx::armem::base::EntityInstanceBase< EntityInstanceDataPtr, EntityInstanceMetadata >::_data
DataT _data
The data. May be nullptr.
Definition: EntityInstanceBase.h:192
armarx::armem::base::EntityInstanceBase< EntityInstanceDataPtr, EntityInstanceMetadata >::index
int & index()
Definition: EntityInstanceBase.h:103
armarx::armem::EntityUpdate::confidence
float confidence
An optional confidence, may be used for things like decay.
Definition: Commit.h:45
Dict.h
armarx::armem::EntityUpdate::arrivedTime
Time arrivedTime
Time when this update arrived at the memory server.
Definition: Commit.h:62
armarx::armem::wm
Definition: MemoryNameSystem.h:46
armarx::armem::base::EntityInstanceBase< EntityInstanceDataPtr, EntityInstanceMetadata >::_metadata
MetadataT _metadata
The metadata.
Definition: EntityInstanceBase.h:189
armarx::armem::base::EntityInstanceMetadata::sentTime
Time sentTime
Time when this value was sent to the memory.
Definition: EntityInstanceBase.h:49
error.h
armarx::armem::EntityUpdate
An update of an entity for a specific point in time.
Definition: Commit.h:27
armarx::armem::wm::EntityInstance::equalsDeep
bool equalsDeep(const EntityInstance &other) const
Definition: memory_definitions.cpp:16
armarx::armem::base::detail::MemoryItem::id
MemoryID & id()
Definition: MemoryItem.h:27
armarx::armem::base::EntityInstanceMetadata::arrivedTime
Time arrivedTime
Time when this value has arrived at the memory.
Definition: EntityInstanceBase.h:51
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
memory_definitions.h
ExpressionException.h
armarx::armem::base::EntityInstanceMetadata::referencedTime
Time referencedTime
Time this instance refers to.
Definition: EntityInstanceBase.h:46
armarx::armem::EntityUpdate::referencedTime
Time referencedTime
Time when this entity update was created (e.g.
Definition: Commit.h:39
armarx::armem::wm::EntityInstance::update
void update(const EntityUpdate &update)
Fill *this with the update's values.
Definition: memory_definitions.cpp:30
armarx::armem::base::EntityInstanceMetadata::confidence
float confidence
An optional confidence, may be used for things like decay.
Definition: EntityInstanceBase.h:54
armarx::armem::base::EntityInstanceBase::metadata
MetadataT & metadata()
Definition: EntityInstanceBase.h:117
armarx::armem::base::EntityInstanceBase::data
const DataT & data() const
Definition: EntityInstanceBase.h:129
armarx::armem::EntityUpdate::sentTime
Time sentTime
Time when this update was sent to the memory server.
Definition: Commit.h:55