SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
leansdr::adder< T > Struct Template Reference

#include <dsp.h>

+ Inheritance diagram for leansdr::adder< T >:
+ Collaboration diagram for leansdr::adder< T >:

Public Member Functions

 adder (scheduler *sch, pipebuf< T > &_in1, pipebuf< T > &_in2, pipebuf< T > &_out)
 
void run ()
 
- Public Member Functions inherited from leansdr::runnable
 runnable (scheduler *_sch, const char *name)
 
- Public Member Functions inherited from leansdr::runnable_common
 runnable_common (const char *_name)
 
virtual ~runnable_common ()
 
virtual void shutdown ()
 

Private Attributes

pipereader< T > in1
 
pipereader< T > in2
 
pipewriter< T > out
 

Additional Inherited Members

- Public Attributes inherited from leansdr::runnable_common
const char * name
 
- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

template<typename T>
struct leansdr::adder< T >

Definition at line 143 of file dsp.h.

Constructor & Destructor Documentation

◆ adder()

template<typename T >
leansdr::adder< T >::adder ( scheduler sch,
pipebuf< T > &  _in1,
pipebuf< T > &  _in2,
pipebuf< T > &  _out 
)
inline

Definition at line 145 of file dsp.h.

147  : runnable(sch, "adder"),
148  in1(_in1), in2(_in2), out(_out)
149  {
150  }
pipereader< T > in1
Definition: dsp.h:167
pipereader< T > in2
Definition: dsp.h:167
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
pipewriter< T > out
Definition: dsp.h:168
scheduler * sch
Definition: framework.h:199

Member Function Documentation

◆ run()

template<typename T >
void leansdr::adder< T >::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 151 of file dsp.h.

References leansdr::cconverter< Tin, Zin, Tout, Zout, Gn, Gd >::out.

152  {
153  int n = out.writable();
154  if (in1.readable() < n)
155  n = in1.readable();
156  if (in2.readable() < n)
157  n = in2.readable();
158  T *pin1 = in1.rd(), *pin2 = in2.rd(), *pout = out.wr(), *pend = pout + n;
159  while (pout < pend)
160  *pout++ = *pin1++ + *pin2++;
161  in1.read(n);
162  in2.read(n);
163  out.written(n);
164  }
pipereader< T > in1
Definition: dsp.h:167
pipereader< T > in2
Definition: dsp.h:167
pipewriter< T > out
Definition: dsp.h:168

Member Data Documentation

◆ in1

template<typename T >
pipereader<T> leansdr::adder< T >::in1
private

Definition at line 167 of file dsp.h.

◆ in2

template<typename T >
pipereader<T> leansdr::adder< T >::in2
private

Definition at line 167 of file dsp.h.

◆ out

template<typename T >
pipewriter<T> leansdr::adder< T >::out
private

Definition at line 168 of file dsp.h.


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