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

Reads raw samples from an imput stream, (ie a file). More...

#include <utils.hh>

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

Public Member Functions

 StreamSource (std::istream &stream, double sample_rate=1, size_t buffersize=1024)
 Constructs a raw input source. More...
 
void next ()
 Reads the next chunk. 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

std::istream & _stream
 The input stream. 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::StreamSource< Scalar >

Reads raw samples from an imput stream, (ie a file).

Constructor & Destructor Documentation

template<class Scalar >
sdr::StreamSource< Scalar >::StreamSource ( std::istream &  stream,
double  sample_rate = 1,
size_t  buffersize = 1024 
)
inline

Constructs a raw input source.

Member Function Documentation

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

Reads the next chunk.

This function might be connected to the idle event of the Queue, then a new chunk gets read once all processing has been performed.

Member Data Documentation

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

The output buffer.

template<class Scalar >
std::istream& sdr::StreamSource< Scalar >::_stream
protected

The input stream.


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