Reader Class Reference

Reads data from a memory server. More...

#include <RobotAPI/libraries/armem/client/Reader.h>

Public Member Functions

server::dto::DirectlyStoreResult directlyStore (const server::dto::DirectlyStoreInput &input) const
 
QueryResult getAll (armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get the whole memory content.
 
QueryResult getAllLatestSnapshots (armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get all latest snapshots in the memory.
 
std::map< MemoryID, std::vector< PredictionEngine > > getAvailablePredictionEngines () const
 Get the list of prediction engines supported by the memory.
 
std::optional< wm::EntitySnapshot > getLatestSnapshotIn (const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get the latest snapshot under the given memory ID.
 
std::optional< wm::EntitySnapshot > getLatestSnapshotOf (const std::vector< MemoryID > &snapshotIDs) const
 Query the given snapshot and return the latest existing snapshot.
 
QueryResult getLatestSnapshotsIn (const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get the latest snapshots under the given memory ID.
 
 operator bool () const
 
std::vector< PredictionResult > predict (const std::vector< PredictionRequest > &requests) const
 Get a prediction for the state of multiple entity instances in the future.
 
QueryResult query (armem::query::data::MemoryQueryPtr query, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 
QueryResult query (armem::query::data::MemoryQueryPtr query, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 
armem::query::data::Result query (const armem::query::data::Input &input) const
 
armem::query::data::Result query (const armem::query::data::Input &input, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 
QueryResult query (const armem::query::data::MemoryQuerySeq &queries, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 
QueryResult query (const armem::query::data::MemoryQuerySeq &queries, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 
QueryResult query (const QueryBuilder &queryBuilder) const
 
QueryResult query (const QueryBuilder &queryBuilder, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 
QueryResult query (const QueryInput &input) const
 Perform a query on the WM.
 
QueryResult query (const QueryInput &input, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 Perform a query with recursive memory link resolution.
 
armem::query::data::Result queryLTM (const armem::query::data::Input &input, bool storeIntoWM=false) const
 Queries the linked ltms.
 
QueryResult queryLTM (const QueryInput &input, bool storeIntoWM=false) const
 Queries the linked ltms.
 
QueryResult queryMemoryIDs (const std::vector< MemoryID > &ids, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Query a specific set of memory IDs.
 
 Reader (const Reader &)=default
 Construct a memory reader.
 
 Reader (server::ReadingMemoryInterfacePrx readingMemory=nullptr, server::PredictingMemoryInterfacePrx predictingMemory=nullptr, server::ReadingLongTermMemoryInterfacePrx readingLtmMemory=nullptr)
 
void setPredictingMemory (server::PredictingMemoryInterfacePrx predictingMemory)
 
void setReadingLtmMemory (server::ReadingLongTermMemoryInterfacePrx readingLtmMemory)
 
void setReadingMemory (server::ReadingMemoryInterfacePrx readingMemory)
 
void startRecording () const
 
void stopRecording () const
 

Public Attributes

server::PredictingMemoryInterfacePrx predictionPrx
 
server::ReadingLongTermMemoryInterfacePrx readingLtmPrx
 
server::ReadingMemoryInterfacePrx readingPrx
 

Detailed Description

Reads data from a memory server.

Constructor & Destructor Documentation

◆ Reader() [1/2]

Reader ( const Reader & )
default

Construct a memory reader.

Parameters
memoryThe memory proxy.

◆ Reader() [2/2]

Reader ( server::ReadingMemoryInterfacePrx readingMemory = nullptr,
server::PredictingMemoryInterfacePrx predictingMemory = nullptr,
server::ReadingLongTermMemoryInterfacePrx readingLtmMemory = nullptr )

Member Function Documentation

◆ directlyStore()

server::dto::DirectlyStoreResult directlyStore ( const server::dto::DirectlyStoreInput & input) const

◆ getAll()

Get the whole memory content.

Parameters
dataModeWith or without data.
Returns
The query result.

◆ getAllLatestSnapshots()

QueryResult getAllLatestSnapshots ( armem::query::DataMode dataMode = armem::query::DataMode::WithData) const

Get all latest snapshots in the memory.

Parameters
dataModeWith or without data.
Returns
The query result.

◆ getAvailablePredictionEngines()

std::map< MemoryID, std::vector< PredictionEngine > > getAvailablePredictionEngines ( ) const

Get the list of prediction engines supported by the memory.

The predictionPrx must not be null when calling this function.

Returns
a map from memory containers to their supported engines

◆ getLatestSnapshotIn()

std::optional< wm::EntitySnapshot > getLatestSnapshotIn ( const MemoryID & id,
armem::query::DataMode dataMode = armem::query::DataMode::WithData ) const

Get the latest snapshot under the given memory ID.

Parameters
idA memory, core segment, provider segment or entity ID.
dataModeWith or without data.
Returns
The latest contained snapshot, if any.

◆ getLatestSnapshotOf()

std::optional< wm::EntitySnapshot > getLatestSnapshotOf ( const std::vector< MemoryID > & snapshotIDs) const

Query the given snapshot and return the latest existing snapshot.

Parameters
snapshotIDsThe snapshot (or entity) IDs.
Returns
The latest snapshot contained in the query result, if any.

◆ getLatestSnapshotsIn()

QueryResult getLatestSnapshotsIn ( const MemoryID & id,
armem::query::DataMode dataMode = armem::query::DataMode::WithData ) const

Get the latest snapshots under the given memory ID.

Parameters
idA memory, core segment, provider segment or entity ID.
dataModeWith or without data.
Returns
The query result.

◆ operator bool()

operator bool ( ) const
inline

◆ predict()

std::vector< PredictionResult > predict ( const std::vector< PredictionRequest > & requests) const

Get a prediction for the state of multiple entity instances in the future.

The timestamp to predict the entities' state at is given via the snapshot given in the MemoryID.

The predictionPrx must not be null when calling this function.

Parameters
requestsa list of requests for entity instance predictions
Returns
the vector of prediction results

◆ query() [1/10]

QueryResult query ( armem::query::data::MemoryQueryPtr query,
armem::client::MemoryNameSystem & mns,
int recursionDepth = -1 ) const
See also
Reader::query(const QueryInput&, armem::client::MemoryNameSystem, int)

◆ query() [2/10]

QueryResult query ( armem::query::data::MemoryQueryPtr query,
armem::query::DataMode dataMode = armem::query::DataMode::WithData ) const

◆ query() [3/10]

armem::query::data::Result query ( const armem::query::data::Input & input) const

◆ query() [4/10]

armem::query::data::Result query ( const armem::query::data::Input & input,
armem::client::MemoryNameSystem & mns,
int recursionDepth = -1 ) const
See also
Reader::query(const QueryInput&, armem::client::MemoryNameSystem, int)

◆ query() [5/10]

QueryResult query ( const armem::query::data::MemoryQuerySeq & queries,
armem::client::MemoryNameSystem & mns,
int recursionDepth = -1 ) const
See also
Reader::query(const QueryInput&, armem::client::MemoryNameSystem, int)

◆ query() [6/10]

QueryResult query ( const armem::query::data::MemoryQuerySeq & queries,
armem::query::DataMode dataMode = armem::query::DataMode::WithData ) const

◆ query() [7/10]

QueryResult query ( const QueryBuilder & queryBuilder) const

◆ query() [8/10]

QueryResult query ( const QueryBuilder & queryBuilder,
armem::client::MemoryNameSystem & mns,
int recursionDepth = -1 ) const
See also
Reader::query(const QueryInput&, armem::client::MemoryNameSystem, int)

◆ query() [9/10]

QueryResult query ( const QueryInput & input) const

Perform a query on the WM.

◆ query() [10/10]

QueryResult query ( const QueryInput & input,
armem::client::MemoryNameSystem & mns,
int recursionDepth = -1 ) const

Perform a query with recursive memory link resolution.

Resolves the links in the query result using the given MemoryNameSystem and inserts the data into the MemoryLink objects' data fields. If the inserted data also contains links, those will be resolved as well up to and including the given recursion depth. Link cycles are detected; the first repeated memory ID will not be inserted into the data. Setting the recursion depth to -1 is equivalent to an infinite recursion depth.

Standalone MemoryID subobjects are ignored; only MemoryIDs inside of MemoryLink subobjects are resolved. Empty or unresolvable MemoryIDs are ignored - this includes MemoryIDs whose Entity fields are not set. If the data associated with a MemoryID could not be retrieved or its type does not match the template type of the MemoryLink, it is ignored.

Parameters
inputthe query to perform
mnsthe MemoryNameSystem to use when resolving MemoryLinks
recursionDepthhow many layers of MemoryLinks to resolve

◆ queryLTM() [1/2]

armem::query::data::Result queryLTM ( const armem::query::data::Input & input,
bool storeIntoWM = false ) const

Queries the linked ltms.

Parameters
storeIntoWMif true the ltm result is also commited to the wm en if recording mode is disabled

◆ queryLTM() [2/2]

QueryResult queryLTM ( const QueryInput & input,
bool storeIntoWM = false ) const

Queries the linked ltms.

Parameters
storeIntoWMif true the ltm result is also commited to the wm en if recording mode is disabled

◆ queryMemoryIDs()

QueryResult queryMemoryIDs ( const std::vector< MemoryID > & ids,
armem::query::DataMode dataMode = armem::query::DataMode::WithData ) const

Query a specific set of memory IDs.

Each ID can refer to an entity, a snapshot or an instance. When not referring to an entity instance, the latest snapshot and first instance will be queried, respectively.

All memory IDs must refer to the memory this reader is reading from. If an ID refers to another memory, the query will not find it and it will not be part of the result.

Parameters
idsThe entity, snapshot or instance IDs.
dataModeWhether to include instance data or just meta data.
Returns
The query result.

◆ setPredictingMemory()

void setPredictingMemory ( server::PredictingMemoryInterfacePrx predictingMemory)

◆ setReadingLtmMemory()

void setReadingLtmMemory ( server::ReadingLongTermMemoryInterfacePrx readingLtmMemory)

◆ setReadingMemory()

void setReadingMemory ( server::ReadingMemoryInterfacePrx readingMemory)

◆ startRecording()

void startRecording ( ) const

◆ stopRecording()

void stopRecording ( ) const

Member Data Documentation

◆ predictionPrx

server::PredictingMemoryInterfacePrx predictionPrx

◆ readingLtmPrx

server::ReadingLongTermMemoryInterfacePrx readingLtmPrx

◆ readingPrx

server::ReadingMemoryInterfacePrx readingPrx

The documentation for this class was generated from the following files: