kwave  18.07.70
Kwave::Functions Class Reference

#include <Functions.h>

Collaboration diagram for Kwave::Functions:
Collaboration graph

Classes

class  FunctionTypesMap
 

Public Types

typedef double() periodic_function_t(double)
 

Public Member Functions

 Functions ()
 
virtual ~Functions ()
 
unsigned int count () const
 
QString name (unsigned int index)
 
periodic_function_tfunction (unsigned int index) const
 

Private Attributes

FunctionTypesMap m_functions_map
 

Detailed Description

Holds a list of simple periodic arithmetic functions. All functions are normed to work within the interval [0...2 Pi]

Definition at line 34 of file Functions.h.

Member Typedef Documentation

◆ periodic_function_t

typedef double() Kwave::Functions::periodic_function_t(double)

Definition at line 38 of file Functions.h.

Constructor & Destructor Documentation

◆ Functions()

Kwave::Functions::Functions ( )

Constructor

Definition at line 104 of file Functions.cpp.

105 {
106 }

◆ ~Functions()

Kwave::Functions::~Functions ( )
virtual

Destructor

Definition at line 109 of file Functions.cpp.

110 {
111 }

Member Function Documentation

◆ count()

unsigned int Kwave::Functions::count ( ) const

Returns the number of functions

Definition at line 135 of file Functions.cpp.

References Kwave::TypesMap< IDX, DATA >::count(), and m_functions_map.

136 {
137  return m_functions_map.count();
138 }
unsigned int count() const
Definition: TypesMap.h:81
FunctionTypesMap m_functions_map
Definition: Functions.h:81
Here is the call graph for this function:

◆ function()

Kwave::Functions::periodic_function_t & Kwave::Functions::function ( unsigned int  index) const

Returns a reference to a function. If the index is out of range, the returned function will be "zero()".

Parameters
index[0...count-1]

Definition at line 122 of file Functions.cpp.

References Kwave::TypesMap< IDX, DATA >::count(), Kwave::TypesMap< IDX, DATA >::data(), m_functions_map, and zero().

124 {
126 
127  Q_ASSERT(index < m_functions_map.count());
128  if (index < m_functions_map.count()) f = m_functions_map.data(index);
129 
130  if (!f) return *(&zero);
131  return *f;
132 }
double() periodic_function_t(double)
Definition: Functions.h:38
unsigned int count() const
Definition: TypesMap.h:81
DATA data(IDX type) const
Definition: TypesMap.h:110
FunctionTypesMap m_functions_map
Definition: Functions.h:81
static double zero(double)
Definition: Functions.cpp:83
Here is the call graph for this function:

◆ name()

QString Kwave::Functions::name ( unsigned int  index)

Returns the name of a function. If the index is out of range, the returned name will be that of the "zero()" function.

Parameters
index[0...count-1]

Definition at line 114 of file Functions.cpp.

References _, Kwave::TypesMap< IDX, DATA >::count(), m_functions_map, and Kwave::TypesMap< IDX, DATA >::name().

115 {
116  Q_ASSERT(index < m_functions_map.count());
117  if (index >= m_functions_map.count()) return _("Zero");
118  return m_functions_map.name(index);
119 }
unsigned int count() const
Definition: TypesMap.h:81
FunctionTypesMap m_functions_map
Definition: Functions.h:81
#define _(m)
Definition: memcpy.c:66
QString name(IDX type) const
Definition: TypesMap.h:117
Here is the call graph for this function:

Member Data Documentation

◆ m_functions_map

FunctionTypesMap Kwave::Functions::m_functions_map
private

map of periodic functions

Definition at line 81 of file Functions.h.

Referenced by count(), function(), and name().


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