HARDT - The Ham Radio DSP Toolkit
Classes | Public Member Functions | List of all members
HSwitch< T > Class Template Reference

#include <hswitch.h>

Inheritance diagram for HSwitch< T >:
Inheritance graph
[legend]
Collaboration diagram for HSwitch< T >:
Collaboration graph
[legend]

Classes

struct  ComponentPtr
 

Public Member Functions

 HSwitch (HWriter< T > *writer, size_t blocksize)
 
 HSwitch (HWriterConsumer< T > *consumer, size_t blocksize)
 
 HSwitch (HReader< T > *reader, size_t blocksize)
 
void SetWriter (HWriter< T > *writer)
 
 ~HSwitch ()
 
int Write (T *src, size_t blocksize)
 
int Read (T *dest, size_t blocksize)
 
void SetPosition (int position)
 
int GetPosition ()
 
void Add (HReader< T > *reader)
 
void Add (HWriter< T > *writer)
 
bool Start ()
 
bool Stop ()
 
bool Command (HCommand *command)
 
- Public Member Functions inherited from HReader< T >
virtual ~HReader ()=default
 
HReader< T > * Reader ()
 
- Public Member Functions inherited from HObject
 HObject ()
 
- Public Member Functions inherited from HWriter< T >
virtual ~HWriter ()=default
 
HWriter< T > * Writer ()
 
- Public Member Functions inherited from HWriterConsumer< T >
HWriterConsumer< T > * Consumer ()
 

Detailed Description

template<class T>
class HSwitch< T >

Implements a switch that can hold a number of object that can be switched between, say 3 filters where the switch position determines which filter gets the reads or writes passed to/from this component

The switch also has a zero-position called "bypass" (index 0), in which all writes or reads are passed through directly

Allthough you can warp the intended usage pattern by supplying output- or nullwriters , this component is really meant to be used as a pass-through device with filters or other types of sample-manipulating objects.

If you are looking for an on-off switch, use the HMute class.

Constructor & Destructor Documentation

◆ HSwitch() [1/3]

template<class T >
HSwitch< T >::HSwitch ( HWriter< T > *  writer,
size_t  blocksize 
)

Construct a new HSwitch that handle writers

◆ HSwitch() [2/3]

template<class T >
HSwitch< T >::HSwitch ( HWriterConsumer< T > *  consumer,
size_t  blocksize 
)

Construct a new HSwitch that handle writer consumers

◆ HSwitch() [3/3]

template<class T >
HSwitch< T >::HSwitch ( HReader< T > *  reader,
size_t  blocksize 
)

Construct a new HSwitch that handle readers

◆ ~HSwitch()

template<class T >
HSwitch< T >::~HSwitch

Default destructor

Member Function Documentation

◆ Add() [1/2]

template<class T >
void HSwitch< T >::Add ( HReader< T > *  reader)

Add reader

◆ Add() [2/2]

template<class T >
void HSwitch< T >::Add ( HWriter< T > *  writer)

Add writer

◆ Command()

template<class T >
bool HSwitch< T >::Command ( HCommand command)
inlinevirtual

Execute or carry through a command

Implements HReader< T >.

◆ GetPosition()

template<class T >
int HSwitch< T >::GetPosition

Get switch position

◆ Read()

template<class T >
int HSwitch< T >::Read ( T *  dest,
size_t  blocksize 
)
virtual

Read a block of samples

Implements HReader< T >.

◆ SetPosition()

template<class T >
void HSwitch< T >::SetPosition ( int  position)

Set switch position

◆ SetWriter()

template<class T >
void HSwitch< T >::SetWriter ( HWriter< T > *  writer)
virtual

◆ Start()

template<class T >
bool HSwitch< T >::Start
virtual

Call Start() on all known components

Reimplemented from HReader< T >.

◆ Stop()

template<class T >
bool HSwitch< T >::Stop
virtual

Call Stop() on all known components

Reimplemented from HReader< T >.

◆ Write()

template<class T >
int HSwitch< T >::Write ( T *  src,
size_t  blocksize 
)
virtual

Write a block of samples

Implements HWriter< T >.


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