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

Truncate history in RemoteGui

parent c48fa3a0
No related branches found
No related tags found
1 merge request!90Armem/memory
......@@ -56,9 +56,29 @@ namespace armarx::armem
GroupBox group;
group.setLabel("Entity '" + entity.name + "'");
for (const auto& [time, snapshot] : entity.history)
if (int(entity.history.size()) <= maxHistorySize)
{
group.addChild(makeGroupBox(*snapshot));
for (const auto& [time, snapshot] : entity.history)
{
group.addChild(makeGroupBox(*snapshot));
}
}
else
{
int margin = 2;
auto it = entity.history.begin();
auto rit = entity.history.end();
--rit;
for (int i = 0; i < margin; ++i, ++it)
{
group.addChild(makeGroupBox(*it->second));
--rit;
}
group.addChild(Label("..."));
for (; rit != entity.history.end(); ++rit)
{
group.addChild(makeGroupBox(*rit->second));
}
}
return group;
......@@ -69,10 +89,13 @@ namespace armarx::armem
MemoryRemoteGui::GroupBox MemoryRemoteGui::makeGroupBox(const EntitySnapshot& snapshot) const
{
static const char* mu = "\u03BC";
(void) mu;
GroupBox group;
std::stringstream ss;
ss << "t = " << snapshot.time.toMicroSeconds() << " " << mu << "s"
<< " (" + snapshot.time.toDateTime() << ")";
ss << "t = " << snapshot.time.toString("%Y-%m-%d %H:%M:%S")
<< "." << snapshot.time.toMicroSeconds() % 1000
// << " (" << snapshot.time.toMicroSeconds() << " " << mu << "s" << ")"
;
group.setLabel(ss.str());
for (const auto& instance : snapshot.instances)
......
......@@ -24,6 +24,9 @@ namespace armarx::armem
GroupBox makeGroupBox(const EntitySnapshot& entitySnapshot) const;
int maxHistorySize = 10;
};
......
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