Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
galaxis::map::data::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 galaxis::map::data::LinePoints< T >

Definition at line 14 of file MapClasses.hpp.

Constructor & Destructor Documentation

◆ LinePoints()

template<typename T >
galaxis::map::data::LinePoints< T >::LinePoints ( )
inline

Definition at line 23 of file MapClasses.hpp.

23 {};

Member Function Documentation

◆ clear()

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

Definition at line 25 of file MapClasses.hpp.

25  {
26  m_mtx.lock();
27 
28  m_pointsXY.clear();
29  m_pointsYX.clear();
30 
31  m_mtx.unlock();
32  }

References galaxis::map::data::LinePoints< T >::m_mtx, galaxis::map::data::LinePoints< T >::m_pointsXY, and galaxis::map::data::LinePoints< T >::m_pointsYX.

◆ getPointsXY()

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

Definition at line 57 of file MapClasses.hpp.

57  {
58  return m_pointsXY;
59  }

References galaxis::map::data::LinePoints< T >::m_pointsXY.

Referenced by LaneDetectionGT::loop().

Here is the caller graph for this function:

◆ getPointsYX()

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

Definition at line 60 of file MapClasses.hpp.

60  {
61  return m_pointsYX;
62  }

References galaxis::map::data::LinePoints< T >::m_pointsYX.

◆ insert()

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

Definition at line 34 of file MapClasses.hpp.

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

References galaxis::map::data::LinePoints< T >::m_mtx, galaxis::map::data::LinePoints< T >::m_pointsXY, and galaxis::map::data::LinePoints< T >::m_pointsYX.

Member Data Documentation

◆ m_mtx

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

◆ m_pointsXY

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

◆ m_pointsYX

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

The documentation for this class was generated from the following file:
galaxis::map::data::LinePoints::m_mtx
std::mutex m_mtx
Definition: MapClasses.hpp:20
galaxis::map::data::LinePoints::m_pointsXY
std::map< T, std::vector< T > > m_pointsXY
Definition: MapClasses.hpp:17
galaxis::map::data::LinePoints::m_pointsYX
std::map< T, std::vector< T > > m_pointsYX
Definition: MapClasses.hpp:18