MemoryIDTreeWidgetItem.cpp
Go to the documentation of this file.
2 
4 
6 
7 
9 {
10 
12  {
13  addChild(new QTreeWidgetItem({"Memory Name"}));
14  addChild(new QTreeWidgetItem({"Core Segment Name"}));
15  addChild(new QTreeWidgetItem({"Provider Segment Name"}));
16  addChild(new QTreeWidgetItem({"Entity Name"}));
17  addChild(new QTreeWidgetItem({"Timestamp"}));
18  addChild(new QTreeWidgetItem({"Instance Index"}));
19  }
20 
21 
22  void MemoryIDTreeWidgetItem::setInstanceID(const MemoryID& id, int valueColumn)
23  {
24  setText(valueColumn, QString::fromStdString(id.str()));
25 
26  const std::vector<std::string> items = id.getAllItems();
27  ARMARX_CHECK_EQUAL(childCount(), static_cast<int>(items.size()));
28  int i = 0;
29  for (const std::string& item : items)
30  {
31  child(i++)->setText(valueColumn, QString::fromStdString(item));
32  }
33  // Timestamp in human-readable format
34  if (id.hasTimestamp())
35  {
36  static const char* mu = "\u03BC";
37  std::stringstream ss;
38  ss << toDateTimeMilliSeconds(id.timestamp)
39  << " (" << id.timestamp.toMicroSecondsSinceEpoch() << " " << mu << "s)";
40  child(4)->setText(valueColumn, QString::fromStdString(ss.str()));
41  }
42  }
43 
44 }
45 
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:42
MemoryID.h
armarx::armem::gui::instance::MemoryIDTreeWidgetItem::addKeyChildren
void addKeyChildren()
Definition: MemoryIDTreeWidgetItem.cpp:11
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::gui::instance
Definition: AronDataView.cpp:2
armarx::armem::toDateTimeMilliSeconds
std::string toDateTimeMilliSeconds(const Time &time, int decimals=6)
Returns timeas e.g.
Definition: Time.cpp:35
armarx::armem::gui::instance::MemoryIDTreeWidgetItem::setInstanceID
void setInstanceID(const MemoryID &id, int valueColumn=1)
Definition: MemoryIDTreeWidgetItem.cpp:22
ExpressionException.h
ARMARX_CHECK_EQUAL
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
Definition: ExpressionException.h:130
MemoryIDTreeWidgetItem.h