Writer.cpp
Go to the documentation of this file.
1 #include "Writer.h"
2 
4 
5 #include <armarx/navigation/memory/aron/LaserScannerFeatures.aron.generated.h>
8 
10 {
11 
12  Writer::~Writer() = default;
13 
14  std::string
16  {
17  return "mem.nav.laser_scanner_features.";
18  }
19 
20  armarx::armem::client::util::SimpleWriterBase::SimpleWriterBase::Properties
22  {
23  return SimpleWriterBase::Properties{.memoryName = memory::constants::NavigationMemoryName,
24  .coreSegmentName =
26  }
27 
28  bool
30  const std::string& providerName,
31  const armem::Time& timestamp)
32  {
33  std::lock_guard g{writeMutex};
34 
35  // const auto result = memoryWriter.addSegment(constants::memoryName,
36  // constants::LaserScannerFeaturesCoreSegment);
37 
38  // if (not result.success)
39  // {
40  // ARMARX_ERROR << result.errorMessage;
41 
42  // // TODO(fabian.reister): message
43  // return false;
44  // }
45 
46  const auto entityID = armem::MemoryID()
48  .withCoreSegmentName(properties().coreSegmentName)
49  .withProviderSegmentName(providerName)
50  .withEntityName(features.frame)
51  .withTimestamp(timestamp);
52 
53  ARMARX_VERBOSE << "Memory id is " << entityID.str();
54 
56  update.entityID = entityID;
57 
59 
60  arondto::LaserScannerFeatures dto;
61  toAron(dto, features);
62 
64 
65  update.instancesData = {dto.toAron()};
66  update.referencedTime = timestamp;
67 
68  ARMARX_DEBUG << "Committing " << update << " at time " << timestamp;
69 
72 
73  ARMARX_DEBUG << updateResult;
74 
75  if (not updateResult.success)
76  {
77  ARMARX_ERROR << updateResult.errorMessage;
78  }
79 
80  return updateResult.success;
81  }
82 
83 } // namespace armarx::navigation::memory::client::laser_scanner_features
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::navigation::memory::LaserScannerFeatures
Definition: types.h:62
armarx::navigation::memory::client::laser_scanner_features::Writer::defaultProperties
Properties defaultProperties() const override
Definition: Writer.cpp:21
armarx::navigation::memory::client::laser_scanner_features::Writer::~Writer
virtual ~Writer()
armarx::armem::MemoryID::withMemoryName
MemoryID withMemoryName(const std::string &name) const
Definition: MemoryID.cpp:396
armarx::armem::EntityUpdateResult
Result of an EntityUpdate.
Definition: Commit.h:72
armarx::navigation::memory::constants::NavigationMemoryName
const std::string NavigationMemoryName
Definition: constants.h:27
aron_conversions.h
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
armarx::armem::MemoryID::withProviderSegmentName
MemoryID withProviderSegmentName(const std::string &name) const
Definition: MemoryID.cpp:412
armarx::armem::client::util::SimpleWriterBase::memoryWriter
armem::client::Writer & memoryWriter()
Definition: SimpleWriterBase.cpp:51
armarx::armem::MemoryID::withCoreSegmentName
MemoryID withCoreSegmentName(const std::string &name) const
Definition: MemoryID.cpp:404
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::armem::client::util::SimpleWriterBase::Properties::memoryName
std::string memoryName
Definition: SimpleWriterBase.h:51
error.h
armarx::armem::EntityUpdate
An update of an entity for a specific point in time.
Definition: Commit.h:27
armarx::armem::client::Writer::commit
CommitResult commit(const Commit &commit) const
Writes a Commit to the memory.
Definition: Writer.cpp:59
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::navigation::memory::client::laser_scanner_features::Writer::propertyPrefix
std::string propertyPrefix() const override
Definition: Writer.cpp:15
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
armarx::navigation::memory::client::laser_scanner_features
Definition: Reader.cpp:30
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::MemoryID::withEntityName
MemoryID withEntityName(const std::string &name) const
Definition: MemoryID.cpp:420
armarx::navigation::memory::toAron
void toAron(arondto::Circle &dto, const Circle &bo)
Definition: aron_conversions.cpp:29
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
Writer.h
armarx::navigation::memory::LaserScannerFeatures::frame
std::string frame
Definition: types.h:65
armarx::armem::client::util::SimpleWriterBase::properties
const Properties & properties() const
Definition: SimpleWriterBase.cpp:57
armarx::armem::MemoryID::withTimestamp
MemoryID withTimestamp(Time time) const
Definition: MemoryID.cpp:428
constants.h
armarx::navigation::memory::client::laser_scanner_features::Writer::store
bool store(const LaserScannerFeatures &features, const std::string &providerName, const armem::Time &timestamp)
Definition: Writer.cpp:29
armarx::navigation::memory::constants::LaserScannerFeaturesCoreSegment
const std::string LaserScannerFeaturesCoreSegment
Definition: constants.h:36
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:29