Skip to content
Snippets Groups Projects
Commit fdf01373 authored by Christoph Pohl's avatar Christoph Pohl
Browse files

Improve memory reader interface

parent 1dde129b
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ namespace armarx::manipulation::memory::client::core
using armem::client::util::SimpleReaderBase::SimpleReaderBase;
std::vector<BusinessObj>
query(const std::string& providerName,
query(const std::optional<std::string>& providerName = std::nullopt,
const std::optional<std::string>& entityName = std::nullopt,
const std::optional<armem::Time>& startTime = std::nullopt,
const std::optional<armem::Time>& endTime = std::nullopt)
......@@ -60,8 +60,15 @@ namespace armarx::manipulation::memory::client::core
ps = std::experimental::make_observer(&qb.coreSegments()
.withName(properties().coreSegmentName)
.providerSegments()
.withName(providerName));
.providerSegments());
if (providerName.has_value())
{
ps = std::experimental::make_observer(&ps->withName(providerName.value()));
}
else
{
ps = std::experimental::make_observer(&ps->all());
}
if (entityName.has_value())
{
es = std::experimental::make_observer(&ps->entities().withName(entityName.value()));
......@@ -82,7 +89,7 @@ namespace armarx::manipulation::memory::client::core
}
(void*)ss.get();
const auto query = qb.buildQueryInput();
return fromQuery(memoryReader().query(query), providerName);
return fromQuery(memoryReader().query(query));
}
std::string
......@@ -100,9 +107,9 @@ namespace armarx::manipulation::memory::client::core
private:
std::vector<BusinessObj>
fromQuery(const armem::client::QueryResult& query, const std::string& providerName)
fromQuery(const armem::client::QueryResult& query)
{
return ImplT::fromQuery(query, properties().coreSegmentName, providerName);
return ImplT::fromQuery(query, properties().coreSegmentName);
}
};
} // namespace armarx::manipulation::memory::client::core
\ No newline at end of file
......@@ -30,11 +30,9 @@ namespace armarx::manipulation::memory::client::core
std::vector<manipulation::core::ExecutableAction>
ReaderImplementation<armarx::manipulation::core::ExecutableAction>::fromQuery(
const armem::client::QueryResult& query,
const std::string& coreSegment,
const std::string& providerSegment)
const std::string& coreSegment)
{
const auto& segment =
query.memory.getCoreSegment(coreSegment).getProviderSegment(providerSegment);
const auto& segment = query.memory.getCoreSegment(coreSegment);
std::vector<armarx::manipulation::core::ExecutableAction> actions;
segment.forEachInstance(
[&actions](const auto& instance)
......
......@@ -37,9 +37,7 @@ namespace armarx::manipulation::memory::client
static constexpr std::string_view providerName = "";
static std::vector<manipulation::core::ExecutableAction>
fromQuery(const armem::client::QueryResult& query,
const std::string& coreSegment,
const std::string& providerSegment);
fromQuery(const armem::client::QueryResult& query, const std::string& coreSegment);
};
......
......@@ -31,11 +31,10 @@ namespace armarx::manipulation::memory::client::core
std::vector<manipulation::core::ExecutedAction>
ReaderImplementation<armarx::manipulation::core::ExecutedAction>::fromQuery(
const armem::client::QueryResult& query,
const std::string& coreSegment,
const std::string& providerSegment)
const std::string& coreSegment)
{
const auto& segment =
query.memory.getCoreSegment(coreSegment).getProviderSegment(providerSegment);
const auto& segment = query.memory.getCoreSegment(coreSegment);
std::vector<armarx::manipulation::core::ExecutedAction> actions;
segment.forEachInstance(
[&actions](const auto& instance)
......
......@@ -37,9 +37,7 @@ namespace armarx::manipulation::memory::client
static constexpr std::string_view providerName = "";
static std::vector<manipulation::core::ExecutedAction>
fromQuery(const armem::client::QueryResult& query,
const std::string& coreSegment,
const std::string& providerSegment);
fromQuery(const armem::client::QueryResult& query, const std::string& coreSegment);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment