Skip to content
Snippets Groups Projects
Commit 03ea4190 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add reloading to Object/Class segment

parent c1ddbde6
No related branches found
No related tags found
No related merge requests found
......@@ -185,28 +185,35 @@ namespace armarx::armem::server::obj
{
using namespace armarx::RemoteGui::Client;
tab.instance.setup(*this);
tab.clazz.setup(classSegment);
tab.reset(new RemoteGuiTab);
tab->instance.setup(*this);
tab->clazz.setup(classSegment);
HBoxLayout segments =
{
tab.instance.group,
tab.clazz.group
tab->instance.group,
tab->clazz.group
};
VBoxLayout root =
{
segments,
VSpacer()
};
RemoteGui_createTab(Component::getName(), root, &tab);
RemoteGui_createTab(Component::getName(), root, tab.get());
}
void ObjectMemory::RemoteGui_update()
{
// Non-atomic variables need to be guarded by a mutex if accessed by multiple threads
tab.instance.update(*this);
tab.clazz.update(classSegment);
tab->instance.update(*this);
tab->clazz.update(classSegment);
if (tab->clazz.data.rebuild)
{
createRemoteGuiTab();
}
}
}
......@@ -122,7 +122,7 @@ namespace armarx::armem::server::obj
instance::SegmentAdapter::RemoteGui instance;
clazz::Segment::RemoteGui clazz;
};
RemoteGuiTab tab;
std::unique_ptr<RemoteGuiTab> tab;
};
......
......@@ -79,7 +79,10 @@ namespace armarx::armem::server::obj::clazz
std::vector<ObjectInfo> infos = objectFinder.findAllObjects(checkPaths);
const MemoryID providerID = coreSegment->id().withProviderSegmentName(objectFinder.getPackageName());
coreSegment->addProviderSegment(providerID.providerSegmentName);
if (not coreSegment->hasProviderSegment(providerID.providerSegmentName))
{
coreSegment->addProviderSegment(providerID.providerSegmentName);
}
ARMARX_INFO << "Loading up to " << infos.size() << " object classes from '"
<< objectFinder.getPackageName() << "' ...";
......@@ -225,12 +228,16 @@ namespace armarx::armem::server::obj::clazz
{
using namespace armarx::RemoteGui::Client;
reloadButton.setLabel("Reload");
maxHistorySize.setValue(std::max(1, int(segment.p.maxHistorySize)));
maxHistorySize.setRange(1, 1e6);
infiniteHistory.setValue(segment.p.maxHistorySize == -1);
GridLayout grid;
int row = 0;
grid.add(reloadButton, {row, 0}, {1, 2});
row++;
grid.add(Label("Max History Size"), {row, 0}).add(maxHistorySize, {row, 1});
row++;
grid.add(Label("Infinite History Size"), {row, 0}).add(infiniteHistory, {row, 1});
......@@ -243,6 +250,12 @@ namespace armarx::armem::server::obj::clazz
void Segment::RemoteGui::Data::update(Segment& segment)
{
if (reloadButton.wasClicked())
{
std::scoped_lock lock(segment.memoryMutex);
segment.loadByObjectFinder();
rebuild = true;
}
if (infiniteHistory.hasValueChanged() || maxHistorySize.hasValueChanged())
{
std::scoped_lock lock(segment.memoryMutex);
......
......@@ -76,11 +76,14 @@ namespace armarx::armem::server::obj::clazz
{
armarx::RemoteGui::Client::GroupBox group;
armarx::RemoteGui::Client::Button reloadButton;
armarx::RemoteGui::Client::IntSpinBox maxHistorySize;
armarx::RemoteGui::Client::CheckBox infiniteHistory;
void setup(const Segment& segment);
void update(Segment& segment);
bool rebuild = false;
};
Data data;
......
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