GNU Radio C++ API Reference: file_meta_source.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
file_meta_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2012 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H
12#define INCLUDED_BLOCKS_FILE_META_SOURCE_H
13
14#include <gnuradio/blocks/api.h>
15#include <gnuradio/sync_block.h>
16
17namespace gr {
18namespace blocks {
19
20/*!
21 * \brief Reads stream from file with meta-data headers. Headers
22 * are parsed into tags.
23 * \ingroup file_operators_blk
24 *
25 * \details
26 * The information in the metadata headers includes:
27 *
28 * \li rx_rate (double): sample rate of data.
29 * \li rx_time (uint64_t, double): time stamp of first sample in segment.
30 * \li size (uint32_t): item size in bytes.
31 * \li type (::gr_file_types as int32_t): data type.
32 * \li cplx (bool): Is data complex?
33 * \li strt (uint64_t): Starting byte of data in this segment.
34 * \li bytes (uint64_t): Size in bytes of data in this segment.
35 *
36 * Any item inside of the extra header dictionary is ready out and
37 * made into a stream tag.
38 */
39 class BLOCKS_API file_meta_source : virtual public sync_block
40{
41public:
42 // gr::blocks::file_meta_source::sptr
43 typedef std::shared_ptr<file_meta_source> sptr;
44
45 /*!
46 * \brief Create a meta-data file source.
47 *
48 * \param filename (string): Name of file to write data to.
49 * \param repeat (bool): Repeats file when EOF is found.
50 * \param detached_header (bool): Set to true if header
51 * info is stored in a separate file (usually named filename.hdr)
52 * \param hdr_filename (string): Name of detached header file if used.
53 * Defaults to 'filename.hdr' if detached_header is true but this
54 * field is an empty string.
55 */
56 static sptr make(const std::string& filename,
57 bool repeat = false,
58 bool detached_header = false,
59 const std::string& hdr_filename = "");
60
61 virtual bool open(const std::string& filename,
62 const std::string& hdr_filename = "") = 0;
63 virtual void close() = 0;
64 virtual void do_update() = 0;
65};
66
67} /* namespace blocks */
68} /* namespace gr */
69
70#endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */
gr::blocks::file_meta_source
Reads stream from file with meta-data headers. Headers are parsed into tags.
Definition file_meta_source.h:40
gr::blocks::file_meta_source::close
virtual void close()=0
gr::blocks::file_meta_source::open
virtual bool open(const std::string &filename, const std::string &hdr_filename="")=0
gr::blocks::file_meta_source::do_update
virtual void do_update()=0
gr::blocks::file_meta_source::make
static sptr make(const std::string &filename, bool repeat=false, bool detached_header=false, const std::string &hdr_filename="")
Create a meta-data file source.
gr::blocks::file_meta_source::sptr
std::shared_ptr< file_meta_source > sptr
Definition file_meta_source.h:43
gr::blocks::repeat
repeat each input repeat times
Definition repeat.h:30
gr::sync_block::sync_block
sync_block(void)
Definition sync_block.h:28
api.h
BLOCKS_API
#define BLOCKS_API
Definition gr-blocks/include/gnuradio/blocks/api.h:18
gr::blocks
Definition abs_blk.h:20
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_block.h