GNU Radio 3.6.5 C++ API

gr_file_source Class Reference

Read stream from file. More...

#include <gr_file_source.h>

Inheritance diagram for gr_file_source:
gr_sync_block gr_block gr_basic_block gr_msg_accepter gruel::msg_accepter

List of all members.

Public Member Functions

 ~gr_file_source ()
int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
 just like gr_block::general_work, only this arranges to call consume_each for you
bool seek (long seek_point, int whence)
 Seek file to seek_point relative to whence.
void open (const char *filename, bool repeat)
 Opens a new file.
void close ()
 Close the file handle.

Protected Member Functions

 gr_file_source (size_t itemsize, const char *filename, bool repeat)
void do_update ()

Protected Attributes

boost::mutex fp_mutex

Friends

GR_CORE_API gr_file_source_sptr gr_make_file_source (size_t itemsize, const char *filename, bool repeat)
 Create a file source.

Detailed Description

Read stream from file.


Constructor & Destructor Documentation

gr_file_source::gr_file_source ( size_t  itemsize,
const char *  filename,
bool  repeat 
) [protected]
gr_file_source::~gr_file_source ( )

Member Function Documentation

void gr_file_source::close ( )

Close the file handle.

void gr_file_source::do_update ( ) [protected]
void gr_file_source::open ( const char *  filename,
bool  repeat 
)

Opens a new file.

Parameters:
filenamename of the file to source from
repeatrepeat file from start
bool gr_file_source::seek ( long  seek_point,
int  whence 
)

Seek file to seek_point relative to whence.

Parameters:
seek_pointsample offset in file
whenceone of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
int gr_file_source::work ( int  noutput_items,
gr_vector_const_void_star input_items,
gr_vector_void_star output_items 
) [virtual]

just like gr_block::general_work, only this arranges to call consume_each for you

The user must override work to define the signal processing code

Implements gr_sync_block.


Friends And Related Function Documentation

GR_CORE_API gr_file_source_sptr gr_make_file_source ( size_t  itemsize,
const char *  filename,
bool  repeat 
) [friend]

Create a file source.

Opens filename as a source of items into a flowgraph. The data is expected to be in binary format, item after item. The itemsize of the block determines the conversion from bits to items.

If repeat is turned on, the file will repeat the file after it's reached the end.

Parameters:
itemsizethe size of each item in the file, in bytes
filenamename of the file to source from
repeatrepeat file from start

Member Data Documentation

boost::mutex gr_file_source::fp_mutex [protected]

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