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. More...
 
QueryResult getAllLatestSnapshots (armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get all latest snapshots in the memory. More...
 
std::map< MemoryID, std::vector< PredictionEngine > > getAvailablePredictionEngines () const
 Get the list of prediction engines supported by the memory. More...
 
std::optional< wm::EntitySnapshotgetLatestSnapshotIn (const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get the latest snapshot under the given memory ID. More...
 
std::optional< wm::EntitySnapshotgetLatestSnapshotOf (const std::vector< MemoryID > &snapshotIDs) const
 Query the given snapshot and return the latest existing snapshot. More...
 
QueryResult getLatestSnapshotsIn (const MemoryID &id, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Get the latest snapshots under the given memory ID. More...
 
 operator bool () const
 
std::vector< PredictionResultpredict (const std::vector< PredictionRequest > &requests) const
 Get a prediction for the state of multiple entity instances in the future. More...
 
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. More...
 
QueryResult query (const QueryInput &input, armem::client::MemoryNameSystem &mns, int recursionDepth=-1) const
 Perform a query with recursive memory link resolution. More...
 
QueryResult queryMemoryIDs (const std::vector< MemoryID > &ids, armem::query::DataMode dataMode=armem::query::DataMode::WithData) const
 Query a specific set of memory IDs. More...
 
 Reader (const Reader &)=default
 Construct a memory reader. More...
 
 Reader (server::ReadingMemoryInterfacePrx readingMemory=nullptr, server::PredictingMemoryInterfacePrx predictingMemory=nullptr)
 
void setPredictingMemory (server::PredictingMemoryInterfacePrx predictingMemory)
 
void setReadingMemory (server::ReadingMemoryInterfacePrx readingMemory)
 
void startRecording () const
 
void stopRecording () const
 

Public Attributes

server::PredictingMemoryInterfacePrx predictionPrx
 
server::ReadingMemoryInterfacePrx readingPrx
 

Detailed Description

Reads data from a memory server.

Definition at line 24 of file Reader.h.

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 
)

Definition at line 25 of file Reader.cpp.

Member Function Documentation

◆ directlyStore()

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

Definition at line 420 of file Reader.cpp.

◆ getAll()

Get the whole memory content.

Parameters
dataModeWith or without data.
Returns
The query result.

Definition at line 409 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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.

Definition at line 398 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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

Definition at line 526 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Definition at line 370 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Definition at line 313 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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.

Definition at line 343 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator bool()

operator bool ( ) const
inline

Definition at line 197 of file Reader.h.

◆ 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

Definition at line 482 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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)

Definition at line 137 of file Reader.cpp.

+ Here is the call graph for this function:

◆ query() [2/10]

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

Definition at line 71 of file Reader.cpp.

+ Here is the call graph for this function:

◆ query() [3/10]

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

Definition at line 40 of file Reader.cpp.

◆ 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)

Definition at line 100 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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)

Definition at line 145 of file Reader.cpp.

+ Here is the call graph for this function:

◆ query() [6/10]

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

Definition at line 77 of file Reader.cpp.

+ Here is the call graph for this function:

◆ query() [7/10]

QueryResult query ( const QueryBuilder queryBuilder) const

Definition at line 86 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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)

Definition at line 155 of file Reader.cpp.

+ Here is the call graph for this function:

◆ query() [9/10]

QueryResult query ( const QueryInput input) const

Perform a query.

Definition at line 33 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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

Definition at line 92 of file Reader.cpp.

+ Here is the call graph for this function:

◆ 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.

Definition at line 290 of file Reader.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPredictingMemory()

void setPredictingMemory ( server::PredictingMemoryInterfacePrx  predictingMemory)

Definition at line 476 of file Reader.cpp.

◆ setReadingMemory()

void setReadingMemory ( server::ReadingMemoryInterfacePrx  readingMemory)

Definition at line 470 of file Reader.cpp.

◆ startRecording()

void startRecording ( ) const

Definition at line 434 of file Reader.cpp.

◆ stopRecording()

void stopRecording ( ) const

Definition at line 454 of file Reader.cpp.

Member Data Documentation

◆ predictionPrx

server::PredictingMemoryInterfacePrx predictionPrx

Definition at line 210 of file Reader.h.

◆ readingPrx

server::ReadingMemoryInterfacePrx readingPrx

Definition at line 209 of file Reader.h.


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