libsdr  0.1.0
A simple SDR library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sdr::GWNSource< Scalar > Class Template Reference

A Gaussian White Noise source. More...

#include <utils.hh>

Inheritance diagram for sdr::GWNSource< Scalar >:
sdr::Source

Public Member Functions

 GWNSource (double sample_rate, size_t buffer_size=1024)
 Constructor. More...
 
virtual ~GWNSource ()
 Destructor. More...
 
void next ()
 Samples and emits the next chunk of data. More...
 
- Public Member Functions inherited from sdr::Source
 Source ()
 Constructor. More...
 
virtual ~Source ()
 Destructor. More...
 
virtual void send (const RawBuffer &buffer, bool allow_overwrite=false)
 Sends the given buffer to all connected sinks. More...
 
void connect (SinkBase *sink, bool direct=false)
 Connect this source to a sink. More...
 
void disconnect (SinkBase *sink)
 Disconnect a sink again. More...
 
virtual void setConfig (const Config &config)
 Stores the configuration and propergates it if the configuration has been changed. More...
 
virtual double sampleRate () const
 Returns the configured sample rate or 0 otherwise. More...
 
virtual Config::Type type () const
 Returns the configured source type or Config::Type_UNDEFINED otherwise. More...
 
template<class T >
void addEOS (T *instance, void(T::*function)())
 Adds a callback to the end-of-stream signal of the source. More...
 

Protected Member Functions

void _getNormal (double &a, double &b)
 Sample two std. More...
 
- Protected Member Functions inherited from sdr::Source
void signalEOS ()
 Signals the EOS. More...
 
void propagateConfig (const Config &config)
 Propagates the given configuration to all connected sinks. More...
 

Protected Attributes

double _sample_rate
 The sample rate. More...
 
size_t _buffer_size
 The size of the buffer. More...
 
Buffer< Scalar > _buffer
 The output buffer. More...
 
double _mean
 The mean value of the GWN. More...
 
- Protected Attributes inherited from sdr::Source
Config _config
 Holds the source configuration, this can be updated by calling setConfig. More...
 
std::map< SinkBase *, bool > _sinks
 The connected sinks. More...
 
std::list< DelegateInterface * > _eos
 The connected EOS singal handlers. More...
 

Detailed Description

template<class Scalar>
class sdr::GWNSource< Scalar >

A Gaussian White Noise source.

Constructor & Destructor Documentation

template<class Scalar >
sdr::GWNSource< Scalar >::GWNSource ( double  sample_rate,
size_t  buffer_size = 1024 
)
inline

Constructor.

template<class Scalar >
virtual sdr::GWNSource< Scalar >::~GWNSource ( )
inlinevirtual

Destructor.

Member Function Documentation

template<class Scalar >
void sdr::GWNSource< Scalar >::_getNormal ( double &  a,
double &  b 
)
inlineprotected

Sample two std.

normal distributed RVs.

template<class Scalar >
void sdr::GWNSource< Scalar >::next ( )
inline

Samples and emits the next chunk of data.

This function can be connected to the idle event of the Queue instance, such that a new chunk gets emitted, once all previous chunks are processed.

Member Data Documentation

template<class Scalar >
Buffer<Scalar> sdr::GWNSource< Scalar >::_buffer
protected

The output buffer.

template<class Scalar >
size_t sdr::GWNSource< Scalar >::_buffer_size
protected

The size of the buffer.

template<class Scalar >
double sdr::GWNSource< Scalar >::_mean
protected

The mean value of the GWN.

template<class Scalar >
double sdr::GWNSource< Scalar >::_sample_rate
protected

The sample rate.


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