GNU Radio Manual and C++ API Reference  3.7.13.4
The Free & Open Software Radio Ecosystem
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H
24 #define INCLUDED_BLOCKS_FILE_META_SOURCE_H
25 
26 #include <gnuradio/blocks/api.h>
27 #include <gnuradio/sync_block.h>
28 
29 namespace gr {
30  namespace blocks {
31 
32  /*!
33  * \brief Reads stream from file with meta-data headers. Headers
34  * are parsed into tags.
35  * \ingroup file_operators_blk
36  *
37  * \details
38  * The information in the metadata headers includes:
39  *
40  * \li rx_rate (double): sample rate of data.
41  * \li rx_time (uint64_t, double): time stamp of first sample in segment.
42  * \li size (uint32_t): item size in bytes.
43  * \li type (::gr_file_types as int32_t): data type.
44  * \li cplx (bool): Is data complex?
45  * \li strt (uint64_t): Starting byte of data in this segment.
46  * \li bytes (uint64_t): Size in bytes of data in this segment.
47  *
48  * Any item inside of the extra header dictionary is ready out and
49  * made into a stream tag.
50  */
51  class BLOCKS_API file_meta_source : virtual public sync_block
52  {
53  public:
54  // gr::blocks::file_meta_source::sptr
55  typedef boost::shared_ptr<file_meta_source> sptr;
56 
57  /*!
58  * \brief Create a meta-data file source.
59  *
60  * \param filename (string): Name of file to write data to.
61  * \param repeat (bool): Repeats file when EOF is found.
62  * \param detached_header (bool): Set to true if header
63  * info is stored in a separate file (usually named filename.hdr)
64  * \param hdr_filename (string): Name of detached header file if used.
65  * Defaults to 'filename.hdr' if detached_header is true but this
66  * field is an empty string.
67  */
68  static sptr make(const std::string &filename,
69  bool repeat=false,
70  bool detached_header=false,
71  const std::string &hdr_filename="");
72 
73  virtual bool open(const std::string &filename,
74  const std::string &hdr_filename="") = 0;
75  virtual void close() = 0;
76  virtual void do_update() = 0;
77  };
78 
79  } /* namespace blocks */
80 } /* namespace gr */
81 
82 #endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */
boost::shared_ptr< file_meta_source > sptr
Definition: file_meta_source.h:55
Include this header to use the message passing features.
Definition: logger.h:695
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
repeat each input repeat timesMessage Ports:
Definition: repeat.h:40
Reads stream from file with meta-data headers. Headers are parsed into tags.
Definition: file_meta_source.h:51