Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
map::classes::LinePoints< T > Class Template Reference

#include <MapClasses.hpp>

Public Member Functions

 LinePoints ()
 
void clear ()
 
void insert (T x, T y)
 
std::map< T, std::vector< T > > & getPointsXY ()
 
std::map< T, std::vector< T > > & getPointsYX ()
 

Private Attributes

std::map< T, std::vector< T > > m_pointsXY
 
std::map< T, std::vector< T > > m_pointsYX
 
std::mutex m_mtx
 

Detailed Description

template<typename T>
class map::classes::LinePoints< T >

Definition at line 19 of file MapClasses.hpp.

Constructor & Destructor Documentation

◆ LinePoints()

template<typename T >
map::classes::LinePoints< T >::LinePoints ( )
inline

Definition at line 28 of file MapClasses.hpp.

28 {};

Member Function Documentation

◆ clear()

template<typename T >
void map::classes::LinePoints< T >::clear ( )
inline

Definition at line 30 of file MapClasses.hpp.

30  {
31  m_mtx.lock();
32 
33  m_pointsXY.clear();
34  m_pointsYX.clear();
35 
36  m_mtx.unlock();
37  }

Referenced by map::classes::LinesObject< T >::clear().

Here is the caller graph for this function:

◆ getPointsXY()

template<typename T >
std::map<T, std::vector<T> >& map::classes::LinePoints< T >::getPointsXY ( )
inline

Definition at line 62 of file MapClasses.hpp.

62  {
63  return m_pointsXY;
64  }

Referenced by AutoPilotNode::send_full_map_debug_image(), and AutoPilotNode::send_map_debug_image().

Here is the caller graph for this function:

◆ getPointsYX()

template<typename T >
std::map<T, std::vector<T> >& map::classes::LinePoints< T >::getPointsYX ( )
inline

Definition at line 65 of file MapClasses.hpp.

65  {
66  return m_pointsYX;
67  }

◆ insert()

template<typename T >
void map::classes::LinePoints< T >::insert ( T  x,
T  y 
)
inline

Definition at line 39 of file MapClasses.hpp.

39  {
40  m_mtx.lock();
41 
42  auto itX = m_pointsXY.find(x);
43  if(itX == m_pointsXY.end()) {
44  // insert new vector
45  m_pointsXY.insert(std::pair<T, std::vector<T>>(x, std::vector<T>{ y }));
46  } else {
47  itX->second.push_back(y);
48  }
49 
50  auto itY = m_pointsYX.find(y);
51  if(itY == m_pointsYX.end()) {
52  // insert new vector
53  m_pointsYX.insert(std::pair<T, std::vector<T>>(y, std::vector<T>{ x }));
54  }
55  else {
56  itY->second.push_back(x);
57  }
58 
59  m_mtx.unlock();
60  }

Member Data Documentation

◆ m_mtx

template<typename T >
std::mutex map::classes::LinePoints< T >::m_mtx
private

Definition at line 25 of file MapClasses.hpp.

◆ m_pointsXY

template<typename T >
std::map<T, std::vector<T> > map::classes::LinePoints< T >::m_pointsXY
private

Definition at line 22 of file MapClasses.hpp.

◆ m_pointsYX

template<typename T >
std::map<T, std::vector<T> > map::classes::LinePoints< T >::m_pointsYX
private

Definition at line 23 of file MapClasses.hpp.


The documentation for this class was generated from the following file:
map::classes::LinePoints::m_pointsYX
std::map< T, std::vector< T > > m_pointsYX
Definition: MapClasses.hpp:23
map::classes::LinePoints::m_pointsXY
std::map< T, std::vector< T > > m_pointsXY
Definition: MapClasses.hpp:22
map::classes::LinePoints::m_mtx
std::mutex m_mtx
Definition: MapClasses.hpp:25