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

Simple averaging sub-sampler. More...

#include <subsample.hh>

Inheritance diagram for sdr::SubSample< Scalar >:
sdr::Sink< Scalar > sdr::Source sdr::SinkBase

Public Types

typedef Traits< Scalar >::SScalar SScalar
 The super-scalar of the input type. More...
 

Public Member Functions

 SubSample (size_t n)
 Constructs a sub-sampler. More...
 
 SubSample (double Fs)
 Constructs a sub-sampler by target sample rate. More...
 
virtual void config (const Config &src_cfg)
 Configures the sub-sampler. More...
 
virtual void process (const Buffer< Scalar > &buffer, bool allow_overwrite)
 Performs the sub-sampling on the given buffer. More...
 
- Public Member Functions inherited from sdr::Sink< Scalar >
 Sink ()
 Constructor. More...
 
virtual ~Sink ()
 Drestructor. More...
 
virtual void handleBuffer (const RawBuffer &buffer, bool allow_overwrite)
 Re-implemented from SinkBase. More...
 
- Public Member Functions inherited from sdr::SinkBase
 SinkBase ()
 Constructor. More...
 
virtual ~SinkBase ()
 Destructor. 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 _process (const Buffer< Scalar > &in, const Buffer< Scalar > &out)
 Performs the sub-sampling from in into out. 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

size_t _n
 The sub-sampling, n=1 means no sub-sampling at all. More...
 
double _oFs
 Target sample rate. More...
 
SScalar _last
 The last value. More...
 
size_t _left
 How many samples are left. More...
 
Buffer< Scalar > _buffer
 The output buffer, unused if the sub-sampling is performed in-place. 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::SubSample< Scalar >

Simple averaging sub-sampler.

Member Typedef Documentation

template<class Scalar >
typedef Traits<Scalar>::SScalar sdr::SubSample< Scalar >::SScalar

The super-scalar of the input type.

Constructor & Destructor Documentation

template<class Scalar >
sdr::SubSample< Scalar >::SubSample ( size_t  n)
inline

Constructs a sub-sampler.

template<class Scalar >
sdr::SubSample< Scalar >::SubSample ( double  Fs)
inline

Constructs a sub-sampler by target sample rate.

Member Function Documentation

template<class Scalar >
void sdr::SubSample< Scalar >::_process ( const Buffer< Scalar > &  in,
const Buffer< Scalar > &  out 
)
inlineprotected

Performs the sub-sampling from in into out.

template<class Scalar >
virtual void sdr::SubSample< Scalar >::config ( const Config src_cfg)
inlinevirtual

Configures the sub-sampler.

Implements sdr::SinkBase.

template<class Scalar >
virtual void sdr::SubSample< Scalar >::process ( const Buffer< Scalar > &  buffer,
bool  allow_overwrite 
)
inlinevirtual

Performs the sub-sampling on the given buffer.

Implements sdr::Sink< Scalar >.

Member Data Documentation

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

The output buffer, unused if the sub-sampling is performed in-place.

template<class Scalar >
SScalar sdr::SubSample< Scalar >::_last
protected

The last value.

template<class Scalar >
size_t sdr::SubSample< Scalar >::_left
protected

How many samples are left.

template<class Scalar >
size_t sdr::SubSample< Scalar >::_n
protected

The sub-sampling, n=1 means no sub-sampling at all.

template<class Scalar >
double sdr::SubSample< Scalar >::_oFs
protected

Target sample rate.


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