SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
Max2D< T > Class Template Reference

#include <max2d.h>

Public Member Functions

 Max2D ()
 
 ~Max2D ()
 
void resize (unsigned int width, unsigned int size)
 
bool storeAndGetMax (T &max, T v, unsigned int index)
 
bool nextMax ()
 

Private Attributes

T * m_max
 
unsigned int m_maxSize
 
unsigned int m_width
 
unsigned int m_size
 
unsigned int m_maxIndex
 

Detailed Description

template<typename T>
class Max2D< T >

Definition at line 25 of file max2d.h.

Constructor & Destructor Documentation

◆ Max2D()

template<typename T>
Max2D< T >::Max2D ( )
inline

Definition at line 28 of file max2d.h.

28 : m_max(0), m_maxSize(0), m_width(0), m_size(0), m_maxIndex(0) {}
unsigned int m_maxIndex
Definition: max2d.h:105
unsigned int m_size
Definition: max2d.h:104
T * m_max
Definition: max2d.h:101
unsigned int m_width
Definition: max2d.h:103
unsigned int m_maxSize
Definition: max2d.h:102

◆ ~Max2D()

template<typename T>
Max2D< T >::~Max2D ( )
inline

Definition at line 30 of file max2d.h.

31  {
32  if (m_max) {
33  delete[] m_max;
34  }
35  }
T * m_max
Definition: max2d.h:101

Member Function Documentation

◆ nextMax()

template<typename T>
bool Max2D< T >::nextMax ( )
inline

Definition at line 81 of file max2d.h.

Referenced by SpectrumVis::feed().

82  {
83  if (m_size <= 1) {
84  return true;
85  }
86 
87  if (m_maxIndex == m_size - 1)
88  {
89  m_maxIndex = 0;
90  std::fill(m_max, m_max+m_width, 0);
91  return true;
92  }
93  else
94  {
95  m_maxIndex++;
96  return false;
97  }
98  }
unsigned int m_maxIndex
Definition: max2d.h:105
unsigned int m_size
Definition: max2d.h:104
T * m_max
Definition: max2d.h:101
unsigned int m_width
Definition: max2d.h:103
+ Here is the caller graph for this function:

◆ resize()

template<typename T>
void Max2D< T >::resize ( unsigned int  width,
unsigned int  size 
)
inline

Definition at line 37 of file max2d.h.

Referenced by SpectrumVis::handleConfigure().

38  {
39  if (width > m_maxSize)
40  {
41  m_maxSize = width;
42  if (m_max) {
43  delete[] m_max;
44  }
45  m_max = new T[m_maxSize];
46  }
47 
48  m_width = width;
49  m_size = size;
50 
51  std::fill(m_max, m_max+m_width, 0);
52  m_maxIndex = 0;
53  }
unsigned int m_maxIndex
Definition: max2d.h:105
unsigned int m_size
Definition: max2d.h:104
T * m_max
Definition: max2d.h:101
unsigned int m_width
Definition: max2d.h:103
unsigned int m_maxSize
Definition: max2d.h:102
+ Here is the caller graph for this function:

◆ storeAndGetMax()

template<typename T>
bool Max2D< T >::storeAndGetMax ( T &  max,
v,
unsigned int  index 
)
inline

Definition at line 55 of file max2d.h.

Referenced by SpectrumVis::feed().

56  {
57  if (m_size <= 1)
58  {
59  max = v;
60  return true;
61  }
62 
63  if (m_maxIndex == 0)
64  {
65  m_max[index] = v;
66  return false;
67  }
68  else if (m_maxIndex == m_size - 1)
69  {
70  m_max[index] = std::max(m_max[index], v);
71  max = m_max[index];
72  return true;
73  }
74  else
75  {
76  m_max[index] = std::max(m_max[index], v);
77  return false;
78  }
79  }
unsigned int m_maxIndex
Definition: max2d.h:105
unsigned int m_size
Definition: max2d.h:104
T * m_max
Definition: max2d.h:101
T max(const T &x, const T &y)
Definition: framework.h:446
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_max

template<typename T>
T* Max2D< T >::m_max
private

◆ m_maxIndex

template<typename T>
unsigned int Max2D< T >::m_maxIndex
private

◆ m_maxSize

template<typename T>
unsigned int Max2D< T >::m_maxSize
private

Definition at line 102 of file max2d.h.

Referenced by Max2D< double >::resize().

◆ m_size

template<typename T>
unsigned int Max2D< T >::m_size
private

◆ m_width

template<typename T>
unsigned int Max2D< T >::m_width
private

Definition at line 103 of file max2d.h.

Referenced by Max2D< double >::nextMax(), and Max2D< double >::resize().


The documentation for this class was generated from the following file: