MemoryBase< _CoreSegmentT, _Derived > Class Template Reference

Data of a memory consisting of multiple core segments. More...

#include <RobotAPI/libraries/armem/core/base/MemoryBase.h>

+ Inheritance diagram for MemoryBase< _CoreSegmentT, _Derived >:

Classes

struct  UpdateResult
 

Public Types

using ChildT = CoreSegmentT
 
using CoreSegmentT = _CoreSegmentT
 
using EntityInstanceT = typename EntitySnapshotT::EntityInstanceT
 
using EntitySnapshotT = typename EntityT::EntitySnapshotT
 
using EntityT = typename ProviderSegmentT::EntityT
 
using ProviderSegmentT = typename CoreSegmentT::ProviderSegmentT
 
- Public Types inherited from MemoryContainerBase< std::map< std::string, _CoreSegmentT >, _Derived >
using ContainerT = std::map< std::string, _CoreSegmentT >
 
using DerivedT = _Derived
 

Public Member Functions

CoreSegmentTaddCoreSegment (const CoreSegmentT &coreSegment)
 Copy and insert a core segment. More...
 
template<class... Args>
CoreSegmentTaddCoreSegment (const std::string &name, Args... args)
 Move and insert a core segment. More...
 
CoreSegmentTaddCoreSegment (const std::string &name, aron::type::ObjectPtr coreSegmentType=nullptr, const std::vector< PredictionEngine > &predictionEngines={})
 Add an empty core segment with the given name, type and prediction engines. More...
 
CoreSegmentTaddCoreSegment (CoreSegmentT &&coreSegment)
 Move and insert a core segment. More...
 
template<class OtherDerivedT >
void append (const OtherDerivedT &other)
 Merge another memory into this one. More...
 
bool equalsDeep (const MemoryBase &other) const
 
CoreSegmentTfindCoreSegment (const MemoryID &coreSegmentID)
 
const CoreSegmentTfindCoreSegment (const MemoryID &coreSegmentID) const
 
CoreSegmentTfindCoreSegment (const std::string &name)
 
const CoreSegmentTfindCoreSegment (const std::string &name) const
 
template<class CoreSegmentFunctionT >
bool forEachCoreSegment (CoreSegmentFunctionT &&func)
 
template<class CoreSegmentFunctionT >
bool forEachCoreSegment (CoreSegmentFunctionT &&func) const
 
template<class InstanceFunctionT >
bool forEachInstanceIn (const MemoryID &id, InstanceFunctionT &&func)
 
template<class InstanceFunctionT >
bool forEachInstanceIn (const MemoryID &id, InstanceFunctionT &&func) const
 
CoreSegmentTgetCoreSegment (const MemoryID &coreSegmentID)
 
const CoreSegmentTgetCoreSegment (const MemoryID &coreSegmentID) const
 
CoreSegmentTgetCoreSegment (const std::string &name)
 
const CoreSegmentTgetCoreSegment (const std::string &name) const
 
std::vector< std::string > getCoreSegmentNames () const
 
std::string getKeyString () const
 
bool hasCoreSegment (const MemoryID &coreSegmentID) const
 
bool hasCoreSegment (const std::string &name) const
 
 MemoryBase ()
 
 MemoryBase (const MemoryBase &other)=default
 
 MemoryBase (const MemoryID &id, const std::vector< PredictionEngine > &predictionEngines={})
 
 MemoryBase (const std::string &name, const std::vector< PredictionEngine > &predictionEngines={})
 
 MemoryBase (MemoryBase &&other)=default
 
std::string & name ()
 
const std::string & name () const
 
MemoryBaseoperator= (const MemoryBase &other)=default
 
MemoryBaseoperator= (MemoryBase &&other)=default
 
void setName (const std::string &name)
 
std::vector< UpdateResultupdate (const Commit &commit, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
 Store all updates in commit. More...
 
UpdateResult update (const EntityUpdate &update, const bool addMissingCoreSegmentDuringUpdate=false, const bool checkMemoryName=true)
 Store the given update. More...
 
- Public Member Functions inherited from MemoryContainerBase< std::map< std::string, _CoreSegmentT >, _Derived >
ContainerT::iterator begin ()
 
ContainerT::const_iterator begin () const
 
void clear ()
 
bool empty () const
 
ContainerT::iterator end ()
 
ContainerT::const_iterator end () const
 
bool forEachChild (ChildFunctionT &&func)
 
bool forEachChild (ChildFunctionT &&func) const
 
 MemoryContainerBase ()
 
 MemoryContainerBase (const MemoryContainerBase &other)=default
 
 MemoryContainerBase (const MemoryID &id)
 
 MemoryContainerBase (MemoryContainerBase &&other)=default
 
MemoryContainerBaseoperator= (const MemoryContainerBase &other)=default
 
MemoryContainerBaseoperator= (MemoryContainerBase &&other)=default
 
std::size_t size () const
 
- Public Member Functions inherited from MemoryItem
MemoryIDid ()
 
const MemoryIDid () const
 
 MemoryItem ()
 
 MemoryItem (const MemoryID &id)
 
 MemoryItem (const MemoryItem &other)=default
 
 MemoryItem (MemoryItem &&other)=default
 
MemoryItemoperator= (const MemoryItem &other)=default
 
MemoryItemoperator= (MemoryItem &&other)=default
 
- Public Member Functions inherited from PredictiveContainer< _Derived >
std::map< MemoryID, std::vector< PredictionEngine > > getAllPredictionEngines () const
 
- Public Member Functions inherited from Predictive< _Derived >
void addPredictionEngine (const PredictionEngine &engine)
 
std::map< MemoryID, std::vector< PredictionEngine > > getAllPredictionEngines () const
 
const std::vector< PredictionEngine > & predictionEngines () const
 
 Predictive (const std::vector< PredictionEngine > &engines={})
 
void setPredictionEngines (const std::vector< PredictionEngine > &engines)
 
- Public Member Functions inherited from ForEachEntityInstanceMixin< _Derived >
bool forEachInstance (InstanceFunctionT &&func)
 
bool forEachInstance (InstanceFunctionT &&func) const
 
bool forEachInstanceAs (AronDtoFunctionT &&func) const
 Call func on the data of each instance converted to Aron DTO class. More...
 
bool forEachInstanceWithDataAs (EntityInstanceBaseAronDtoFunctionT &&func) const
 Call func on each instance with its data converted to Aron DTO class. More...
 
- Public Member Functions inherited from ForEachEntitySnapshotMixin< _Derived >
bool forEachSnapshot (SnapshotFunctionT &&func)
 
bool forEachSnapshot (SnapshotFunctionT &&func) const
 
- Public Member Functions inherited from ForEachEntityMixin< _Derived >
bool forEachEntity (FunctionT &&func)
 
bool forEachEntity (FunctionT &&func) const
 
- Public Member Functions inherited from ForEachProviderSegmentMixin< _Derived >
bool forEachProviderSegment (FunctionT &&func)
 
bool forEachProviderSegment (FunctionT &&func) const
 
- Public Member Functions inherited from GetFindInstanceMixin< _Derived >
auto * findInstance (const MemoryID &instanceID)
 Find an entity instance. More...
 
const auto * findInstance (const MemoryID &instanceID) const
 
auto & getInstance (const MemoryID &instanceID)
 Retrieve an entity instance. More...
 
const auto & getInstance (const MemoryID &instanceID) const
 
bool hasInstance (const MemoryID &instanceID) const
 Indicate whether this container has an instance with the given ID. More...
 
bool hasInstances () const
 Indicate whether this container contains at least one entity instance. More...
 
- Public Member Functions inherited from GetFindSnapshotMixin< _Derived >
auto * findLatestInstance (const MemoryID &entityID, int instanceIndex=0)
 Find the latest entity instance in the given entity. More...
 
const auto * findLatestInstance (const MemoryID &entityID, int instanceIndex=0) const
 
auto * findLatestInstance (int instanceIndex=0)
 
const auto * findLatestInstance (int instanceIndex=0) const
 Find the latest entity instance. More...
 
auto * findLatestSnapshot ()
 
const auto * findLatestSnapshot () const
 Find the latest entity snapshot. More...
 
auto * findLatestSnapshot (const MemoryID &entityID)
 Find the latest entity snapshot in the given entity. More...
 
const auto * findLatestSnapshot (const MemoryID &entityID) const
 
auto * findSnapshot (const MemoryID &snapshotID)
 Find an entity snapshot. More...
 
const auto * findSnapshot (const MemoryID &snapshotID) const
 
auto & getSnapshot (const MemoryID &snapshotID)
 Retrieve an entity snapshot. More...
 
const auto & getSnapshot (const MemoryID &snapshotID) const
 
bool hasSnapshot (const MemoryID &snapshotID) const
 Indicates whether a snapshot with the given ID exists. More...
 
bool hasSnapshots () const
 Indicate whether this container contains at least one entity snapshot. More...
 
- Public Member Functions inherited from GetLatestInstanceMixin< _Derived >
auto & getLatestInstance (int instanceIndex=0)
 Retrieve the latest entity instance. More...
 
const auto & getLatestInstance (int instanceIndex=0) const
 
- Public Member Functions inherited from GetLatestSnapshotMixin< _Derived >
auto & getLatestSnapshot (int snapshotIndex=0)
 Retrieve the latest entity snapshot. More...
 
const auto & getLatestSnapshot (int snapshotIndex=0) const
 
- Public Member Functions inherited from GetFindEntityMixin< _Derived >
auto * findEntity (const MemoryID &entityID)
 Find an entity. More...
 
const auto * findEntity (const MemoryID &entityID) const
 
auto & getEntity (const MemoryID &entityID)
 Retrieve an entity. More...
 
const auto & getEntity (const MemoryID &entityID) const
 
bool hasEntity (const MemoryID &entityID) const
 
- Public Member Functions inherited from GetFindProviderSegmentMixin< _Derived >
auto * findProviderSegment (const MemoryID &providerSegmentID)
 Retrieve a provider segment. More...
 
const auto * findProviderSegment (const MemoryID &providerSegmentID) const
 
auto & getProviderSegment (const MemoryID &providerSegmentID)
 Retrieve a provider segment. More...
 
const auto & getProviderSegment (const MemoryID &providerSegmentID) const
 
bool hasProviderSegment (const MemoryID &providerSegmentID) const
 

Static Public Member Functions

static std::string getLevelName ()
 

Protected Member Functions

std::pair< bool, CoreSegmentT * > _addCoreSegmentIfMissing (const std::string &coreSegmentName, const bool addMissingCoreSegmentDuringUpdate)
 
- Protected Member Functions inherited from MemoryContainerBase< std::map< std::string, _CoreSegmentT >, _Derived >
ChildT & _addChild (const KeyT &key, ChildArgs... childArgs)
 
void _checkContainerName (const std::string &gottenName, const std::string &actualName, bool emptyOk=true) const
 
DerivedT_derived ()
 
const DerivedT_derived () const
 
ContainerTcontainer ()
 
const ContainerTcontainer () const
 
- Protected Member Functions inherited from MemoryItem
 ~MemoryItem ()
 

Additional Inherited Members

- Protected Attributes inherited from MemoryContainerBase< std::map< std::string, _CoreSegmentT >, _Derived >
ContainerT _container
 
- Protected Attributes inherited from MemoryItem
MemoryID _id
 

Detailed Description

template<class _CoreSegmentT, class _Derived>
class armarx::armem::base::MemoryBase< _CoreSegmentT, _Derived >

Data of a memory consisting of multiple core segments.

Definition at line 19 of file MemoryBase.h.

Member Typedef Documentation

◆ ChildT

Definition at line 43 of file MemoryBase.h.

◆ CoreSegmentT

using CoreSegmentT = _CoreSegmentT

Definition at line 37 of file MemoryBase.h.

◆ EntityInstanceT

using EntityInstanceT = typename EntitySnapshotT::EntityInstanceT

Definition at line 41 of file MemoryBase.h.

◆ EntitySnapshotT

using EntitySnapshotT = typename EntityT::EntitySnapshotT

Definition at line 40 of file MemoryBase.h.

◆ EntityT

using EntityT = typename ProviderSegmentT::EntityT

Definition at line 39 of file MemoryBase.h.

◆ ProviderSegmentT

using ProviderSegmentT = typename CoreSegmentT::ProviderSegmentT

Definition at line 38 of file MemoryBase.h.

Constructor & Destructor Documentation

◆ MemoryBase() [1/5]

MemoryBase ( )
inline

Definition at line 67 of file MemoryBase.h.

◆ MemoryBase() [2/5]

MemoryBase ( const std::string &  name,
const std::vector< PredictionEngine > &  predictionEngines = {} 
)
inlineexplicit

Definition at line 71 of file MemoryBase.h.

◆ MemoryBase() [3/5]

MemoryBase ( const MemoryID id,
const std::vector< PredictionEngine > &  predictionEngines = {} 
)
inlineexplicit

Definition at line 77 of file MemoryBase.h.

◆ MemoryBase() [4/5]

MemoryBase ( const MemoryBase< _CoreSegmentT, _Derived > &  other)
default

◆ MemoryBase() [5/5]

MemoryBase ( MemoryBase< _CoreSegmentT, _Derived > &&  other)
default

Member Function Documentation

◆ _addCoreSegmentIfMissing()

std::pair<bool, CoreSegmentT*> _addCoreSegmentIfMissing ( const std::string &  coreSegmentName,
const bool  addMissingCoreSegmentDuringUpdate 
)
inlineprotected

Definition at line 412 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ addCoreSegment() [1/4]

CoreSegmentT& addCoreSegment ( const CoreSegmentT coreSegment)
inline

Copy and insert a core segment.

Definition at line 268 of file MemoryBase.h.

◆ addCoreSegment() [2/4]

CoreSegmentT& addCoreSegment ( const std::string &  name,
Args...  args 
)
inline

Move and insert a core segment.

Definition at line 284 of file MemoryBase.h.

◆ addCoreSegment() [3/4]

CoreSegmentT& addCoreSegment ( const std::string &  name,
aron::type::ObjectPtr  coreSegmentType = nullptr,
const std::vector< PredictionEngine > &  predictionEngines = {} 
)
inline

Add an empty core segment with the given name, type and prediction engines.

Parameters
nameThe core segment name.
coreSegmentTypeThe core segment type (optional).
predictionEnginesThe prediction engines supported by the core segment (optional).
Returns
The added core segment.

Definition at line 259 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ addCoreSegment() [4/4]

CoreSegmentT& addCoreSegment ( CoreSegmentT &&  coreSegment)
inline

Move and insert a core segment.

Definition at line 275 of file MemoryBase.h.

◆ append()

void append ( const OtherDerivedT &  other)
inline

Merge another memory into this one.

Append all data and types if possible

Parameters
mThe other memory

Definition at line 347 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ equalsDeep()

bool equalsDeep ( const MemoryBase< _CoreSegmentT, _Derived > &  other) const
inline

Definition at line 375 of file MemoryBase.h.

◆ findCoreSegment() [1/4]

CoreSegmentT* findCoreSegment ( const MemoryID coreSegmentID)
inline

Definition at line 145 of file MemoryBase.h.

◆ findCoreSegment() [2/4]

const CoreSegmentT* findCoreSegment ( const MemoryID coreSegmentID) const
inline

Definition at line 152 of file MemoryBase.h.

◆ findCoreSegment() [3/4]

CoreSegmentT* findCoreSegment ( const std::string &  name)
inline

Definition at line 119 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ findCoreSegment() [4/4]

const CoreSegmentT* findCoreSegment ( const std::string &  name) const
inline

Definition at line 125 of file MemoryBase.h.

◆ forEachCoreSegment() [1/2]

bool forEachCoreSegment ( CoreSegmentFunctionT &&  func)
inline
Parameters
funcFunction like: bool process(CoreSegmentT& coreSeg)

Definition at line 186 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ forEachCoreSegment() [2/2]

bool forEachCoreSegment ( CoreSegmentFunctionT &&  func) const
inline
Parameters
funcFunction like: bool process(const CoreSegmentT& coreSeg)

Definition at line 196 of file MemoryBase.h.

◆ forEachInstanceIn() [1/2]

bool forEachInstanceIn ( const MemoryID id,
InstanceFunctionT &&  func 
)
inline
Parameters
funcFunction like void process(EntityInstanceT& instance)>

Definition at line 212 of file MemoryBase.h.

◆ forEachInstanceIn() [2/2]

bool forEachInstanceIn ( const MemoryID id,
InstanceFunctionT &&  func 
) const
inline
Parameters
funcFunction like void process(EntityInstanceT& instance)>

Definition at line 227 of file MemoryBase.h.

◆ getCoreSegment() [1/4]

CoreSegmentT& getCoreSegment ( const MemoryID coreSegmentID)
inline

Definition at line 160 of file MemoryBase.h.

◆ getCoreSegment() [2/4]

const CoreSegmentT& getCoreSegment ( const MemoryID coreSegmentID) const
inline

Definition at line 167 of file MemoryBase.h.

◆ getCoreSegment() [3/4]

CoreSegmentT& getCoreSegment ( const std::string &  name)
inline

Definition at line 132 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ getCoreSegment() [4/4]

const CoreSegmentT& getCoreSegment ( const std::string &  name) const
inline

Definition at line 138 of file MemoryBase.h.

◆ getCoreSegmentNames()

std::vector<std::string> getCoreSegmentNames ( ) const
inline

Definition at line 238 of file MemoryBase.h.

◆ getKeyString()

std::string getKeyString ( ) const
inline

Definition at line 404 of file MemoryBase.h.

◆ getLevelName()

static std::string getLevelName ( )
inlinestatic

Definition at line 398 of file MemoryBase.h.

◆ hasCoreSegment() [1/2]

bool hasCoreSegment ( const MemoryID coreSegmentID) const
inline

Definition at line 112 of file MemoryBase.h.

◆ hasCoreSegment() [2/2]

bool hasCoreSegment ( const std::string &  name) const
inline

Definition at line 105 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ name() [1/2]

std::string& name ( )
inline

Definition at line 92 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ name() [2/2]

const std::string& name ( ) const
inline

Definition at line 98 of file MemoryBase.h.

◆ operator=() [1/2]

MemoryBase& operator= ( const MemoryBase< _CoreSegmentT, _Derived > &  other)
default

◆ operator=() [2/2]

MemoryBase& operator= ( MemoryBase< _CoreSegmentT, _Derived > &&  other)
default

◆ setName()

void setName ( const std::string &  name)
inline

Definition at line 246 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ update() [1/2]

std::vector<UpdateResult> update ( const Commit commit,
const bool  addMissingCoreSegmentDuringUpdate = false,
const bool  checkMemoryName = true 
)
inline

Store all updates in commit.

Parameters
commitThe commit.
Returns
The resulting memory IDs.

Definition at line 297 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ update() [2/2]

UpdateResult update ( const EntityUpdate update,
const bool  addMissingCoreSegmentDuringUpdate = false,
const bool  checkMemoryName = true 
)
inline

Store the given update.

Parameters
updateThe update.
Returns
The resulting entity snapshot's ID.

Definition at line 316 of file MemoryBase.h.


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