Public Member Functions | Public Attributes | List of all members
SineWaveCreator Class Reference

Data creator: sine wave data. More...

Inheritance diagram for SineWaveCreator:
DataCreatorBase

Public Member Functions

 SineWaveCreator (std::string name, float new_period, float new_amplitude)
 Constructor: assigns data set name and noise parameters. More...
 
virtual InputData_t create (size_t size) override
 Creates and returns the data sample. More...
 
- Public Member Functions inherited from DataCreatorBase
 DataCreatorBase (std::string new_name)
 Constructor: just assigns a name to this data set. More...
 
std::string name () const
 Returns the name of this set. More...
 
virtual ~DataCreatorBase ()
 Virtual destructor. More...
 

Public Attributes

float period
 period of the wave [ticks] More...
 
float amplitude
 amplitude of the wave [ADC counts] More...
 

Additional Inherited Members

- Public Types inherited from DataCreatorBase
typedef std::vector< short > InputData_t
 
- Static Public Attributes inherited from DataCreatorBase
static std::default_random_engine random_engine
 Random engine shared by all the data creators. More...
 

Detailed Description

Data creator: sine wave data.

Definition at line 143 of file raw_test.cc.

Constructor & Destructor Documentation

SineWaveCreator::SineWaveCreator ( std::string  name,
float  new_period,
float  new_amplitude 
)
inline

Constructor: assigns data set name and noise parameters.

Definition at line 150 of file raw_test.cc.

150  :
152  period(new_period), amplitude(new_amplitude)
153  {}
std::string name() const
Returns the name of this set.
Definition: raw_test.cc:72
DataCreatorBase(std::string new_name)
Constructor: just assigns a name to this data set.
Definition: raw_test.cc:69
float period
period of the wave [ticks]
Definition: raw_test.cc:145
float amplitude
amplitude of the wave [ADC counts]
Definition: raw_test.cc:146

Member Function Documentation

virtual InputData_t SineWaveCreator::create ( size_t  size)
inlineoverridevirtual

Creates and returns the data sample.

Implements DataCreatorBase.

Definition at line 156 of file raw_test.cc.

157  {
158  // for c2: constexpr variable 'two_pi' must be initialized by a constant expression
159  //constexpr float two_pi = float(2. * std::acos(-1.));
160  constexpr float two_pi = 2.0F * util::pi<float>();
162  data.reserve(size);
163  for (size_t i = 0; i < size; ++i)
164  data.push_back(amplitude * std::sin(i / period * two_pi));
165  return data;
166  } // create()
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
float period
period of the wave [ticks]
Definition: raw_test.cc:145
float amplitude
amplitude of the wave [ADC counts]
Definition: raw_test.cc:146
std::vector< short > InputData_t
Definition: raw_test.cc:63

Member Data Documentation

float SineWaveCreator::amplitude

amplitude of the wave [ADC counts]

Definition at line 146 of file raw_test.cc.

float SineWaveCreator::period

period of the wave [ticks]

Definition at line 145 of file raw_test.cc.


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