27#include <SimoxUtility/algorithm/get_map_keys_values.h>
28#include <SimoxUtility/algorithm/string/string_tools.h>
42 std::shared_ptr<armem::gui::model::MemoryViewerModel>
model)
44 _model = std::move(
model);
47 _instanceGroupBoxView->instanceView()->setStatusLabel(uiContext.
statusLabel);
50 connect(_instanceGroupBoxView->instanceView(),
68 if (not
id.hasTimestamp())
76 id.timestamp = snapshot->
time();
78 if (not
id.hasInstanceIndex())
84 snapshot = &
data->getSnapshot(
id);
88 _statusLabel->setText(e.what());
91 if (snapshot && snapshot->size() > 0)
96 if (
id.hasInstanceIndex())
98 _instanceGroupBoxView->instanceView()->update(
id, *
data);
103 std::stringstream ss;
104 ss <<
"Memory name '" << selectedID.
memoryName <<
"' is unknown. Known are: "
105 << simox::alg::join(simox::alg::get_keys(_model->memoryDataCopy()),
", ");
106 _statusLabel->setText(QString::fromStdString(ss.str()));
115 auto handleError = [
this](
const std::string& msg)
117 _statusLabel->setText(QString::fromStdString(msg));
121 if (
id.memoryName.empty())
123 handleError(
"Memory name is empty.");
127 std::optional<wm::EntityInstance>
instance;
130 if (
const wm::Memory*
data = _model->getSingleMemoryData(
id.memoryName))
132 segmentType =
data->getProviderSegment(
id).aronType();
134 if (
id.hasInstanceIndex())
138 else if (
id.hasTimestamp())
144 instance =
data->getEntity(
id).getLatestSnapshot().getInstance(0);
149 std::stringstream ss;
150 ss <<
"Memory name '" <<
id.memoryName <<
"' is unknown. Known are: "
151 << simox::alg::join(simox::alg::get_keys(_model->memoryDataCopy()),
", ");
152 _statusLabel->setText(QString::fromStdString(ss.str()));
165 instance = _model->mns().resolveEntityInstance(
id);
170 _statusLabel->setText(e.what());
177 _instanceGroupBoxView->instanceView()->addDataView(
view);
190 return _instanceGroupBoxView;
#define ARMARX_CHECK_NULL(ptr)
bool hasEntityName() const
Base class for all exceptions thrown by the armem library.
void updateInstanceTree(const armem::MemoryID &selectedID)
void resolveMemoryID(const MemoryID &id)
InstanceGroupBoxController(MemoryViewerUIContext &uiContext, std::shared_ptr< armem::gui::model::MemoryViewerModel > model)
armem::gui::view::InstanceGroupBoxView * instanceGroupBoxView() const
void memoryIdResolutionRequested(const MemoryID &id)
Client-side working memory entity snapshot.
Client-side working memory entity.
Client-side working memory.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
instance::InstanceView InstanceView
std::shared_ptr< Object > ObjectPtr
void replaceWidget(WidgetT *&old, QWidget *neu, QLayout *parentLayout)
auto & getLatestSnapshot(int snapshotIndex=0)
Retrieve the latest entity snapshot.
QLayout * instanceGroupBoxParentLayout
QGroupBox * instanceGroupBox