MCPcopy Create free account
hub / github.com/AutonomousFieldRoboticsLab/SVIn / GetHandle

Method GetHandle

pose_graph/src/utils/Statistics.cpp:51–66  ·  view source on GitHub ↗

Static functions to query the stats collectors:

Source from the content-addressed store, hash-verified

49
50// Static functions to query the stats collectors:
51size_t Statistics::GetHandle(std::string const& tag) {
52 std::lock_guard<std::mutex> lock(Instance().mutex_);
53 // Search for an existing tag.
54 map_t::iterator i = Instance().tag_map_.find(tag);
55 if (i == Instance().tag_map_.end()) {
56 // If it is not there, create a tag.
57 size_t handle = Instance().stats_collectors_.size();
58 Instance().tag_map_[tag] = handle;
59 Instance().stats_collectors_.push_back(StatisticsMapValue());
60 // Track the maximum tag length to help printing a table of values later.
61 Instance().max_tag_length_ = std::max(Instance().max_tag_length_, tag.size());
62 return handle;
63 } else {
64 return i->second;
65 }
66}
67
68// Return true if a handle has been initialized for a specific tag.
69// In contrast to GetHandle(), this allows testing for existence without

Callers

nothing calls this directly

Calls 2

StatisticsMapValueClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected