MemoryToIceAdapter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <RobotAPI/interface/armem/client/MemoryListenerInterface.h>
4 #include <RobotAPI/interface/armem/server/MemoryInterface.h>
9 
10 namespace armarx::armem::server
11 {
12 
13  /**
14  * @brief Helps connecting a Memory server to the Ice interface.
15  *
16  * This involves conversion of ice types to C++ types as well as
17  * catchin exceptions and converting them to error messages
18  */
20  {
21  public:
22  /// Construct an MemoryToIceAdapter from an existing Memory.
25 
26  void setMemoryListener(client::MemoryListenerInterfacePrx memoryListenerTopic);
27 
28  // WRITING
29  data::AddSegmentResult addSegment(const data::AddSegmentInput& input,
30  bool addCoreSegments = false);
31 
32  data::AddSegmentsResult addSegments(const data::AddSegmentsInput& input,
33  bool addCoreSegments = false);
34 
35 
36  data::CommitResult commit(const data::Commit& commitIce, Time timeArrived);
37  data::CommitResult commit(const data::Commit& commitIce);
39  data::CommitResult commitLocking(const data::Commit& commitIce, Time timeArrived);
40  data::CommitResult commitLocking(const data::Commit& commitIce);
42 
43 
44  // READING
45  query::data::Result query(const armem::query::data::Input& input);
47 
48  /**
49  * Query the LTMs of the memory server. Stored into WM if recording mode is enabled.
50  * @param storeIntoWM if set the result is also stored into the wm, no matter the recording mode.
51  */
52  query::data::Result queryLTM(const armem::query::data::Input& input, bool storeIntoWM);
53 
54  armem::structure::data::GetServerStructureResult getServerStructure();
55 
56  // LTM LOADING AND REPLAYING
57 
58  /**
59  * Loads all core segments and their data from the LTM.
60  */
62 
63  /**
64  * Only load specific core segments and their data from the LTM.
65  */
66  armem::CommitResult reloadCoreSegmentsFromLTM(std::list<std::string>& coreSegmentname);
67 
69 
70  /**
71  * Triggers a reload (@see reloadFromLTM) only if load on startup property is set.
72  * Loads only the core segments defined in the property 'loadedCoreSegments'
73  */
75 
76  // LTM STORING AND RECORDING
77  dto::DirectlyStoreResult directlyStore(const dto::DirectlyStoreInput& directlStoreInput);
78  dto::StartRecordResult startRecord(const dto::StartRecordInput& startRecordInput);
79  dto::StopRecordResult stopRecord();
80  dto::RecordStatusResult getRecordStatus();
81 
82  // PREDICTION
83  prediction::data::PredictionResultSeq
84  predict(prediction::data::PredictionRequestSeq requests);
85 
86  prediction::data::EngineSupportMap getAvailableEngines();
87 
88  public:
91 
92  client::MemoryListenerInterfacePrx memoryListenerTopic;
93 
94 
95  private:
96  armem::CommitResult _commit(const armem::Commit& commit, bool locking);
97  };
98 
99 
100 } // namespace armarx::armem::server
armarx::armem::server::MemoryToIceAdapter::workingMemory
server::wm::Memory * workingMemory
Definition: MemoryToIceAdapter.h:89
armarx::armem::Commit
A bundle of updates to be sent to the memory.
Definition: Commit.h:89
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
armarx::armem::server::MemoryToIceAdapter::longtermMemory
server::ltm::Memory * longtermMemory
Definition: MemoryToIceAdapter.h:90
armarx::armem::server::MemoryToIceAdapter::startRecord
dto::StartRecordResult startRecord(const dto::StartRecordInput &startRecordInput)
Definition: MemoryToIceAdapter.cpp:532
armarx::armem::server::MemoryToIceAdapter::memoryListenerTopic
client::MemoryListenerInterfacePrx memoryListenerTopic
Definition: MemoryToIceAdapter.h:92
armarx::armem::client::QueryResult
Result of a QueryInput.
Definition: Query.h:50
Query.h
armarx::armem::server::MemoryToIceAdapter::predict
prediction::data::PredictionResultSeq predict(prediction::data::PredictionRequestSeq requests)
Definition: MemoryToIceAdapter.cpp:623
armarx::armem::server::MemoryToIceAdapter::getServerStructure
armem::structure::data::GetServerStructureResult getServerStructure()
Definition: MemoryToIceAdapter.cpp:389
armarx::armem::server::ltm::Memory
A memory storing data on the hard drive and in mongodb (needs 'armarx memory start' to start the mong...
Definition: Memory.h:20
memory_definitions.h
armarx::armem::server::MemoryToIceAdapter::reloadFromLTMOnStartup
armem::CommitResult reloadFromLTMOnStartup()
Triggers a reload (.
Definition: MemoryToIceAdapter.cpp:496
armarx::armem::server::MemoryToIceAdapter::setMemoryListener
void setMemoryListener(client::MemoryListenerInterfacePrx memoryListenerTopic)
Definition: MemoryToIceAdapter.cpp:36
armarx::armem::server::wm::Memory
Definition: memory_definitions.h:122
armarx::armem::server::MemoryToIceAdapter::reloadPropertyDefinedCoreSegmentsFromLTM
armem::CommitResult reloadPropertyDefinedCoreSegmentsFromLTM()
Definition: MemoryToIceAdapter.cpp:471
armarx::armem::client::QueryInput
A query for parts of a memory.
Definition: Query.h:23
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
armarx::armem::CommitResult
Result of a Commit.
Definition: Commit.h:110
armarx::armem::server::MemoryToIceAdapter::getRecordStatus
dto::RecordStatusResult getRecordStatus()
Definition: MemoryToIceAdapter.cpp:588
armarx::armem::server::MemoryToIceAdapter::getAvailableEngines
prediction::data::EngineSupportMap getAvailableEngines()
Definition: MemoryToIceAdapter.cpp:631
memory_definitions.h
armarx::armem::server::MemoryToIceAdapter::stopRecord
dto::StopRecordResult stopRecord()
Definition: MemoryToIceAdapter.cpp:546
armarx::armem::server
Definition: GraspMemory.cpp:34
armarx::armem::server::MemoryToIceAdapter::directlyStore
dto::DirectlyStoreResult directlyStore(const dto::DirectlyStoreInput &directlStoreInput)
Definition: MemoryToIceAdapter.cpp:517
Memory.h
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::server::MemoryToIceAdapter::addSegment
data::AddSegmentResult addSegment(const data::AddSegmentInput &input, bool addCoreSegments=false)
Definition: MemoryToIceAdapter.cpp:43
armarx::armem::server::MemoryToIceAdapter::addSegments
data::AddSegmentsResult addSegments(const data::AddSegmentsInput &input, bool addCoreSegments=false)
Definition: MemoryToIceAdapter.cpp:105
armarx::armem::server::MemoryToIceAdapter::MemoryToIceAdapter
MemoryToIceAdapter(server::wm::Memory *workingMemory=nullptr, server::ltm::Memory *longtermMemory=nullptr)
Construct an MemoryToIceAdapter from an existing Memory.
Definition: MemoryToIceAdapter.cpp:29
armarx::armem::server::MemoryToIceAdapter::reloadCoreSegmentsFromLTM
armem::CommitResult reloadCoreSegmentsFromLTM(std::list< std::string > &coreSegmentname)
Only load specific core segments and their data from the LTM.
Definition: MemoryToIceAdapter.cpp:440
armarx::armem::server::MemoryToIceAdapter::reloadAllFromLTM
armem::CommitResult reloadAllFromLTM()
Loads all core segments and their data from the LTM.
Definition: MemoryToIceAdapter.cpp:420
armarx::armem::server::MemoryToIceAdapter::queryLTM
query::data::Result queryLTM(const armem::query::data::Input &input, bool storeIntoWM)
Query the LTMs of the memory server.
Definition: MemoryToIceAdapter.cpp:345
armarx::armem::server::MemoryToIceAdapter::commitLocking
data::CommitResult commitLocking(const data::Commit &commitIce, Time timeArrived)
Definition: MemoryToIceAdapter.cpp:170
armarx::armem::server::MemoryToIceAdapter::commit
data::CommitResult commit(const data::Commit &commitIce, Time timeArrived)
Definition: MemoryToIceAdapter.cpp:119
armarx::armem::server::MemoryToIceAdapter::query
query::data::Result query(const armem::query::data::Input &input)
Definition: MemoryToIceAdapter.cpp:319