segments.cpp
Go to the documentation of this file.
1 #include "segments.h"
2 
3 namespace visionx
4 {
5 
6  void
7  tools::detail::addSegmentIndex(std::map<uint32_t, pcl::PointIndices>& segmentIndices,
8  uint32_t label,
9  std::size_t index)
10  {
11  // With [] operator, std::map default-constructs a value if it is not already
12  // present, which is exactly what we need here (i.e. no need to explicitly check
13  // key presence).
14  segmentIndices[label].indices.push_back(static_cast<int>(index));
15  }
16 
17  void
18  tools::detail::addSegmentIndex(std::map<uint32_t, pcl::PointIndices::Ptr>& segmentIndices,
19  uint32_t label,
20  std::size_t index)
21  {
22  auto it = segmentIndices.find(label);
23  if (it == segmentIndices.end())
24  {
25  it = segmentIndices.emplace(label, new pcl::PointIndices).first;
26  }
27  it->second->indices.push_back(static_cast<int>(index));
28  }
29 
30 } // namespace visionx
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
index
uint8_t index
Definition: EtherCATFrame.h:59
visionx::tools::detail::addSegmentIndex
void addSegmentIndex(std::map< uint32_t, pcl::PointIndices > &segmentIndices, uint32_t label, std::size_t index)
Definition: segments.cpp:7
segments.h