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::serializer< Tin, Tout > Struct Template Reference

#include <generic.h>

+ Inheritance diagram for leansdr::serializer< Tin, Tout >:
+ Collaboration diagram for leansdr::serializer< Tin, Tout >:

Public Member Functions

 serializer (scheduler *sch, pipebuf< Tin > &_in, pipebuf< Tout > &_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

int nin
 
int nout
 
pipereader< Tin > in
 
pipewriter< Tout > 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 Tin, typename Tout>
struct leansdr::serializer< Tin, Tout >

Definition at line 381 of file generic.h.

Constructor & Destructor Documentation

◆ serializer()

template<typename Tin , typename Tout >
leansdr::serializer< Tin, Tout >::serializer ( scheduler sch,
pipebuf< Tin > &  _in,
pipebuf< Tout > &  _out 
)
inline

Definition at line 383 of file generic.h.

References leansdr::fail().

384  : nin(max((size_t)1, sizeof(Tin) / sizeof(Tout))),
385  nout(max((size_t)1, sizeof(Tout) / sizeof(Tin))),
386  in(_in), out(_out, nout)
387  {
388  if (nin * sizeof(Tin) != nout * sizeof(Tout))
389  fail("serializer: incompatible sizes");
390  }
void fail(const char *s)
Definition: framework.cpp:11
pipereader< Tin > in
Definition: generic.h:403
pipewriter< Tout > out
Definition: generic.h:404
T max(const T &x, const T &y)
Definition: framework.h:446
+ Here is the call graph for this function:

Member Function Documentation

◆ run()

template<typename Tin , typename Tout >
void leansdr::serializer< Tin, Tout >::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 391 of file generic.h.

References leansdr::file_reader< T >::out.

392  {
393  while (in.readable() >= nin && out.writable() >= nout)
394  {
395  memcpy(out.wr(), in.rd(), nout * sizeof(Tout));
396  in.read(nin);
397  out.written(nout);
398  }
399  }
void written(unsigned long n)
Definition: framework.h:308
pipereader< Tin > in
Definition: generic.h:403
pipewriter< Tout > out
Definition: generic.h:404
void read(unsigned long n)
Definition: framework.h:367

Member Data Documentation

◆ in

template<typename Tin , typename Tout >
pipereader<Tin> leansdr::serializer< Tin, Tout >::in
private

Definition at line 403 of file generic.h.

◆ nin

template<typename Tin , typename Tout >
int leansdr::serializer< Tin, Tout >::nin
private

Definition at line 402 of file generic.h.

◆ nout

template<typename Tin , typename Tout >
int leansdr::serializer< Tin, Tout >::nout
private

Definition at line 402 of file generic.h.

◆ out

template<typename Tin , typename Tout >
pipewriter<Tout> leansdr::serializer< Tin, Tout >::out
private

Definition at line 404 of file generic.h.


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