GNU Radio 3.7.1 C++ API
gr::blocks::file_meta_sink Class Reference

Write stream to file with meta-data headers. More...

#include <file_meta_sink.h>

Inheritance diagram for gr::blocks::file_meta_sink:

List of all members.

Public Types

typedef boost::shared_ptr
< file_meta_sink
sptr

Public Member Functions

virtual bool open (const std::string &filename)=0
virtual void close ()=0
virtual void do_update ()=0
virtual void set_unbuffered (bool unbuffered)=0

Static Public Member Functions

static sptr make (size_t itemsize, const std::string &filename, double samp_rate=1, double relative_rate=1, gr_file_types type=GR_FILE_FLOAT, bool complex=true, size_t max_segment_size=1000000, const std::string &extra_dict="", bool detached_header=false)
 Create a meta-data file sink.

Detailed Description

Write stream to file with meta-data headers.

These files represent data as binary information in between meta-data headers. The headers contain information about the type of data and properties of the data in the next segment of samples. The information includes:

rx_rate (double): sample rate of data. rx_time (uint64_t, double): time stamp of first sample in segment. size (uint32_t): item size in bytes. type (gr_file_types as int32_t): data type. cplx (bool): Is data complex? strt (uint64_t): Starting byte of data in this segment. bytes (uint64_t): Size in bytes of data in this segment.

Tags can be sent to the file to update the information, which will create a new header. Headers are found by searching from the first header (at position 0 in the file) and reading where the data segment starts plus the data segment size. Following will either be a new header or EOF.


Member Typedef Documentation


Member Function Documentation

virtual void gr::blocks::file_meta_sink::close ( ) [pure virtual]
virtual void gr::blocks::file_meta_sink::do_update ( ) [pure virtual]
static sptr gr::blocks::file_meta_sink::make ( size_t  itemsize,
const std::string &  filename,
double  samp_rate = 1,
double  relative_rate = 1,
gr_file_types  type = GR_FILE_FLOAT,
bool  complex = true,
size_t  max_segment_size = 1000000,
const std::string &  extra_dict = "",
bool  detached_header = false 
) [static]

Create a meta-data file sink.

Parameters:
itemsize(size_t): Size of data type.
filename(string): Name of file to write data to.
samp_rate(double): Sample rate of data. If sample rate will be set by a tag, such as rx_tag from a UHD source, this is basically ignored.
relative_rate(double): Rate chance from source of sample rate tag to sink.
type(gr_file_types): Data type (int, float, etc.)
complex(bool): If data stream is complex
max_segment_size(size_t): Length of a single segment before the header is repeated (in items).
extra_dict(string): a serialized PMT dictionary of extra information. Currently not supported.
detached_header(bool): Set to true to store the header info in a separate file (named filename.hdr)
virtual bool gr::blocks::file_meta_sink::open ( const std::string &  filename) [pure virtual]
virtual void gr::blocks::file_meta_sink::set_unbuffered ( bool  unbuffered) [pure virtual]

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