ClassWriter.cpp
Go to the documentation of this file.
1 #include "ClassWriter.h"
2 
4 {
5  ClassWriter::ClassWriter(const std::string& p) :
6  providerName(p)
7  {
8 
9  }
10 
11  void ClassWriter::setProviderName(const std::string& pName)
12  {
13  this->providerName = pName;
14  }
15 
16  bool
18  const armarx::core::time::DateTime& referenceTime)
19  {
20  armarx::armem::arondto::ObjectClass objClassAron;
21  armarx::armem::clazz::toAron(objClassAron, c);
22 
27  mid.entityName = c.id.str();
28 
29  auto commit = armarx::armem::Commit();
30  auto& update = commit.add();
31 
32  update.confidence = 1.0f;
33  update.referencedTime = referenceTime;
35  update.entityID = mid;
36  update.instancesData = {objClassAron.toAron()};
37 
38  auto res = this->memoryWriter().commit(commit);
39 
40  return res.allSuccess();
41  }
42 
43  std::string
45  {
46  return "classWriter.";
47  }
48 
51  {
53  p.memoryName = "Object";
54  p.coreSegmentName = "Class";
55  p.providerName = providerName;
56  return p;
57  }
58 
59 } // namespace armarx::armem::obj::clazz
armarx::armem::client::util::SimpleWriterBase::Properties::providerName
std::string providerName
Definition: SimpleWriterBase.h:53
armarx::armem::obj::clazz::ClassWriter::defaultProperties
Properties defaultProperties() const final
Definition: ClassWriter.cpp:50
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:55
armarx::armem::client::util::SimpleWriterBase::Properties::coreSegmentName
std::string coreSegmentName
Definition: SimpleWriterBase.h:52
armarx::armem::client::util::SimpleWriterBase::Properties
Definition: SimpleWriterBase.h:49
ClassWriter.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::armem::obj::clazz::ClassWriter::propertyPrefix
std::string propertyPrefix() const final
Definition: ClassWriter.cpp:44
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:17
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:51
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::util::SimpleWriterBase::Properties::memoryName
std::string memoryName
Definition: SimpleWriterBase.h:51
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:67
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:57
armarx::armem::obj::clazz::ClassWriter::setProviderName
void setProviderName(const std::string &pName)
Definition: ClassWriter.cpp:11
armarx::armem::CommitResult::allSuccess
bool allSuccess() const
Definition: Commit.cpp:64