ClassWriter.cpp
Go to the documentation of this file.
1 #include "ClassWriter.h"
2 
4 {
5  ClassWriter::ClassWriter(const std::string& p) : providerName(p)
6  {
7  }
8 
9  void
10  ClassWriter::setProviderName(const std::string& pName)
11  {
12  this->providerName = pName;
13  }
14 
15  bool
17  const armarx::core::time::DateTime& referenceTime)
18  {
19  armarx::armem::arondto::ObjectClass objClassAron;
20  armarx::armem::clazz::toAron(objClassAron, c);
21 
26  mid.entityName = c.id.str();
27 
28  auto commit = armarx::armem::Commit();
29  auto& update = commit.add();
30 
31  update.confidence = 1.0f;
32  update.referencedTime = referenceTime;
34  update.entityID = mid;
35  update.instancesData = {objClassAron.toAron()};
36 
37  auto res = this->memoryWriter().commit(commit);
38 
39  return res.allSuccess();
40  }
41 
42  std::string
44  {
45  return "classWriter.";
46  }
47 
50  {
52  p.memoryName = "Object";
53  p.coreSegmentName = "Class";
54  p.providerName = providerName;
55  return p;
56  }
57 
58 } // namespace armarx::armem::obj::clazz
armarx::armem::client::util::SimpleWriterBase::Properties::providerName
std::string providerName
Definition: SimpleWriterBase.h:51
armarx::armem::obj::clazz::ClassWriter::defaultProperties
Properties defaultProperties() const final
Definition: ClassWriter.cpp:49
armarx::armem::MemoryID::providerSegmentName
std::string providerSegmentName
Definition: MemoryID.h:52
armarx::armem::Commit
A bundle of updates to be sent to the memory.
Definition: Commit.h:89
armarx::core::time::DateTime::Now
static DateTime Now()
Definition: DateTime.cpp:51
armarx::armem::client::util::SimpleWriterBase::Properties::coreSegmentName
std::string coreSegmentName
Definition: SimpleWriterBase.h:50
armarx::armem::client::util::SimpleWriterBase::Properties
Definition: SimpleWriterBase.h:47
ClassWriter.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::armem::obj::clazz::ClassWriter::propertyPrefix
std::string propertyPrefix() const final
Definition: ClassWriter.cpp:43
armarx::armem::MemoryID::coreSegmentName
std::string coreSegmentName
Definition: MemoryID.h:51
armarx::armem::obj::clazz::ClassWriter::commitObjectClass
bool commitObjectClass(const armarx::armem::clazz::ObjectClass &c, const armarx::core::time::DateTime &referenceTime)
Definition: ClassWriter.cpp:16
armarx::armem::clazz::ObjectClass
Definition: types.h:58
armarx::armem::obj::clazz
Definition: ClassReader.cpp:7
armarx::armem::client::util::SimpleWriterBase::memoryWriter
armem::client::Writer & memoryWriter()
Definition: SimpleWriterBase.cpp:52
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::util::SimpleWriterBase::Properties::memoryName
std::string memoryName
Definition: SimpleWriterBase.h:49
armarx::armem::client::Writer::commit
CommitResult commit(const Commit &commit) const
Writes a Commit to the memory.
Definition: Writer.cpp:59
armarx::armem::MemoryID::entityName
std::string entityName
Definition: MemoryID.h:53
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
armarx::armem::MemoryID::memoryName
std::string memoryName
Definition: MemoryID.h:50
armarx::armem::clazz::toAron
void toAron(armarx::armem::arondto::Feature &dto, const Feature &bo)
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::obj::clazz::ClassWriter::ClassWriter
ClassWriter()=default
armarx::armem::client::util::SimpleWriterBase::properties
const Properties & properties() const
Definition: SimpleWriterBase.cpp:58
armarx::armem::obj::clazz::ClassWriter::setProviderName
void setProviderName(const std::string &pName)
Definition: ClassWriter.cpp:10
armarx::armem::CommitResult::allSuccess
bool allSuccess() const
Definition: Commit.cpp:64