Go to the documentation of this file.
38 std::vector<std::string> keys;
40 for (
auto& strategy : strategies_)
42 std::vector<std::string> strategyKeys = strategy->getContainerKeys(
id);
43 keys.insert(keys.end(), strategyKeys.begin(), strategyKeys.end());
55 std::vector<std::string> keys;
57 for (
auto& strategy : strategies_)
59 std::vector<std::string> strategyKeys = strategy->getItemKeys(
id);
60 keys.insert(keys.end(), strategyKeys.begin(), strategyKeys.end());
71 for (
auto&
s : strategies_)
73 if (
s->containsContainer(
id, key))
87 for (
auto&
s : strategies_)
89 if (
s->containsItem(
id, key))
103 for (
auto&
s : strategies_)
105 s->storeItem(
id, key,
data);
114 for (
auto&
s : strategies_)
116 if (
s->containsItem(
id, key))
118 return s->retrieveItem(
id, key);
122 return std::vector<unsigned char>();
127 for (
auto&
s : strategies_)
129 if (
s->containsItem(
id, key))
131 return s->retrieveItemWithOrigin(
id, key);
135 return {
"undefined4", std::vector<unsigned char>()};
146 for (
auto&
s : strategies_)
148 s->setExportName(exportName);
156 void addStrategy(std::shared_ptr<MemoryPersistenceStrategy> strategy)
158 strategies_.emplace_back(strategy);
171 for (
auto&
s : strategies_)
173 s->createPropertyDefinitions(defs, prefix);
181 for (
auto&
s : strategies_)
191 for (
auto&
s : strategies_)
199 for (
auto&
s : strategies_)
207 std::vector<std::shared_ptr<MemoryPersistenceStrategy>> strategies_;
Basically the option to use multiple ltm sinks as source or target.
std::vector< std::string > getContainerKeys(const armarx::armem::MemoryID &id) override
Returns all containers over all strategies.
void clearStrategies()
Removes all strategies.
Abstract memory persistence strategy (resp.
bool containsContainer(const armarx::armem::MemoryID &id, std::string key) override
Checks if any strategy contains the container.
bool containsItem(const armarx::armem::MemoryID &id, std::string key) override
Checks if any strategy contains the item.
bool isEnabled() override
void addStrategy(std::shared_ptr< MemoryPersistenceStrategy > strategy)
Add another strategy to the end.
Retrieved items' data with an origin (resp.
void setExportName(const std::string &exportName) override
Sets the export name for all strategies.
std::vector< std::string > getItemKeys(const armarx::armem::MemoryID &id) override
Returns all items over all strategies.
void createPropertyDefinitions(PropertyDefinitionsPtr &defs, const std::string &prefix) override
RedundantPersistenceStrategy(std::vector< std::shared_ptr< MemoryPersistenceStrategy >> &strategies)
ItemResult retrieveItemWithOrigin(const armarx::armem::MemoryID &id, std::string &key) override
Retrieves the actual data but also appends the origin which is in this case the strategy identifier.
double s(double t, double s0, double v0, double a0, double j)
void storeItem(const armarx::armem::MemoryID &id, const std::string key, std::vector< unsigned char > &data) override
Stores the item to every strategy.
std::string exportName_
Name of the specific memory export where our items should be stored.
RedundantPersistenceStrategy()=default
std::vector< unsigned char > retrieveItem(const armarx::armem::MemoryID &id, std::string key) override
Retrieves the data of the item following the FIFO principle (if the item exists at any strategy).