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

Arbitrary function generator. More...

#include <siggen.hh>

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

Public Member Functions

 SigGen (double samplerate, size_t buffersize, double tmax=-1)
 Constructs the function generator. More...
 
virtual ~SigGen ()
 Destructor. More...
 
void next ()
 Computes the next buffer. More...
 
void addSine (double freq, double ampl=1, double phase=0)
 Add a sine function to the function generator. 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 Attributes

double _sampleRate
 The sample rate of the function generator. More...
 
double _dt
 The sample period. More...
 
double _t
 The current time. More...
 
double _tMax
 The maximum time. More...
 
double _scale
 The scaling of the signal. More...
 
std::list< std::vector< double > > _signals
 A list of functions. More...
 
size_t _bufferSize
 The size of the output buffer. More...
 
Buffer< Scalar > _buffer
 The output buffer. 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...
 

Additional Inherited Members

- 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...
 

Detailed Description

template<class Scalar>
class sdr::SigGen< Scalar >

Arbitrary function generator.

Constructor & Destructor Documentation

template<class Scalar >
sdr::SigGen< Scalar >::SigGen ( double  samplerate,
size_t  buffersize,
double  tmax = -1 
)
inline

Constructs the function generator.

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

Destructor.

Member Function Documentation

template<class Scalar >
void sdr::SigGen< Scalar >::addSine ( double  freq,
double  ampl = 1,
double  phase = 0 
)
inline

Add a sine function to the function generator.

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

Computes the next buffer.

This function can be connected to the idle signal of the Queue.

Member Data Documentation

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

The output buffer.

template<class Scalar >
size_t sdr::SigGen< Scalar >::_bufferSize
protected

The size of the output buffer.

template<class Scalar >
double sdr::SigGen< Scalar >::_dt
protected

The sample period.

template<class Scalar >
double sdr::SigGen< Scalar >::_sampleRate
protected

The sample rate of the function generator.

template<class Scalar >
double sdr::SigGen< Scalar >::_scale
protected

The scaling of the signal.

template<class Scalar >
std::list< std::vector<double> > sdr::SigGen< Scalar >::_signals
protected

A list of functions.

template<class Scalar >
double sdr::SigGen< Scalar >::_t
protected

The current time.

template<class Scalar >
double sdr::SigGen< Scalar >::_tMax
protected

The maximum time.


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