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

Explicit type cast node. More...

#include <utils.hh>

Inheritance diagram for sdr::Cast< iScalar, oScalar >:
sdr::Sink< iScalar > sdr::Source sdr::SinkBase

Public Types

typedef Traits< iScalar >::SScalar iSScalar
 Specifies the input super scalar. More...
 
typedef Traits< oScalar >::SScalar oSScalar
 Specified the output super scalar. More...
 

Public Member Functions

 Cast (oScalar scale=1, iScalar shift=0)
 Constructs a type-cast with optional scaleing. More...
 
virtual void config (const Config &src_cfg)
 Configures the type-cast node. More...
 
virtual void process (const Buffer< iScalar > &buffer, bool allow_overwrite)
 Performs the type-cast node. More...
 
double scale () const
 Returns the scaling. More...
 
void setScale (double scale)
 Sets the scaling. More...
 
- Public Member Functions inherited from sdr::Sink< iScalar >
 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< iScalar > &in, const Buffer< oScalar > &out)
 Internal used method to perform the type-case out-of-place. 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

bool _can_overwrite
 If true, the type-cast (an scaleing) can be performed in-place. More...
 
bool _do_scale
 If true, the output gets scaled. More...
 
oScalar _scale
 The scaling. More...
 
iScalar _shift
 Another scaling, using integer shift operation (faster). More...
 
Buffer< oScalar > _buffer
 The output buffer, unused if the type-cast 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 iScalar, class oScalar>
class sdr::Cast< iScalar, oScalar >

Explicit type cast node.

Member Typedef Documentation

template<class iScalar , class oScalar >
typedef Traits<iScalar>::SScalar sdr::Cast< iScalar, oScalar >::iSScalar

Specifies the input super scalar.

template<class iScalar , class oScalar >
typedef Traits<oScalar>::SScalar sdr::Cast< iScalar, oScalar >::oSScalar

Specified the output super scalar.

Constructor & Destructor Documentation

template<class iScalar , class oScalar >
sdr::Cast< iScalar, oScalar >::Cast ( oScalar  scale = 1,
iScalar  shift = 0 
)
inline

Constructs a type-cast with optional scaleing.

Member Function Documentation

template<class iScalar , class oScalar >
void sdr::Cast< iScalar, oScalar >::_process ( const Buffer< iScalar > &  in,
const Buffer< oScalar > &  out 
)
inlineprotected

Internal used method to perform the type-case out-of-place.

template<class iScalar , class oScalar >
virtual void sdr::Cast< iScalar, oScalar >::config ( const Config src_cfg)
inlinevirtual

Configures the type-cast node.

Implements sdr::SinkBase.

template<class iScalar , class oScalar >
virtual void sdr::Cast< iScalar, oScalar >::process ( const Buffer< iScalar > &  buffer,
bool  allow_overwrite 
)
inlinevirtual

Performs the type-cast node.

Implements sdr::Sink< iScalar >.

template<class iScalar , class oScalar >
double sdr::Cast< iScalar, oScalar >::scale ( ) const
inline

Returns the scaling.

template<class iScalar , class oScalar >
void sdr::Cast< iScalar, oScalar >::setScale ( double  scale)
inline

Sets the scaling.

Member Data Documentation

template<class iScalar , class oScalar >
Buffer<oScalar> sdr::Cast< iScalar, oScalar >::_buffer
protected

The output buffer, unused if the type-cast is performed in-place .

template<class iScalar , class oScalar >
bool sdr::Cast< iScalar, oScalar >::_can_overwrite
protected

If true, the type-cast (an scaleing) can be performed in-place.

template<class iScalar , class oScalar >
bool sdr::Cast< iScalar, oScalar >::_do_scale
protected

If true, the output gets scaled.

template<class iScalar , class oScalar >
oScalar sdr::Cast< iScalar, oScalar >::_scale
protected

The scaling.

template<class iScalar , class oScalar >
iScalar sdr::Cast< iScalar, oScalar >::_shift
protected

Another scaling, using integer shift operation (faster).


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