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::file_writer< T > Struct Template Reference

#include <generic.h>

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

Public Member Functions

 file_writer (scheduler *sch, pipebuf< T > &_in, int _fdout)
 
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 > in
 
int fdout
 

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::file_writer< T >

Definition at line 119 of file generic.h.

Constructor & Destructor Documentation

◆ file_writer()

template<typename T>
leansdr::file_writer< T >::file_writer ( scheduler sch,
pipebuf< T > &  _in,
int  _fdout 
)
inline

Definition at line 121 of file generic.h.

121  : runnable(sch, _in.name),
122  in(_in), fdout(_fdout)
123  {
124  }
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
pipereader< T > in
Definition: generic.h:141
scheduler * sch
Definition: framework.h:199

Member Function Documentation

◆ run()

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

Reimplemented from leansdr::runnable_common.

Definition at line 125 of file generic.h.

126  {
127  int size = in.readable() * sizeof(T);
128  if (!size)
129  return;
130  int nw = write(fdout, in.rd(), size);
131  if (!nw)
132  fatal("pipe");
133  if (nw < 0)
134  fatal("write");
135  if (nw % sizeof(T))
136  fatal("partial write");
137  in.read(nw / sizeof(T));
138  }
pipereader< T > in
Definition: generic.h:141
void fatal(const char *s)
Definition: framework.cpp:6

Member Data Documentation

◆ fdout

template<typename T>
int leansdr::file_writer< T >::fdout
private

Definition at line 142 of file generic.h.

◆ in

template<typename T>
pipereader<T> leansdr::file_writer< T >::in
private

Definition at line 141 of file generic.h.


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