GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
stream_to_tagged_stream.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013 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_STREAM_TO_TAGGED_STREAM_H
12 #define INCLUDED_BLOCKS_STREAM_TO_TAGGED_STREAM_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Converts a regular stream into a tagged stream.
22  * \ingroup blocks
23  *
24  * All this block does is add length tags in regular intervals.
25  * It can be used to connect a regular stream to a gr::tagged_stream_block.
26  *
27  * \b Careful: This block is meant to be connected directly to a tagged
28  * stream block. If there are blocks between this block and a tagged
29  * stream block, make sure they either don't change the rate, or modify
30  * the tag value to make sure the length tags actually represent the
31  * packet length.
32  */
34 {
35 public:
36  typedef std::shared_ptr<stream_to_tagged_stream> sptr;
37 
38  /*!
39  * \param itemsize Item size
40  * \param vlen Vector length of the input items. Note that one vector is one item.
41  * \param packet_len Number of items per tagged stream packet. One tag is written
42  * every \p packet_len items. \param len_tag_key Key of the length tag.
43  */
44  static sptr make(size_t itemsize,
45  unsigned int vlen,
46  unsigned packet_len,
47  const std::string& len_tag_key);
48  virtual void set_packet_len(unsigned packet_len) = 0;
49  virtual void set_packet_len_pmt(unsigned packet_len) = 0;
50 };
51 
52 } // namespace blocks
53 } // namespace gr
54 
55 #endif /* INCLUDED_BLOCKS_STREAM_TO_TAGGED_STREAM_H */
Converts a regular stream into a tagged stream.
Definition: stream_to_tagged_stream.h:34
virtual void set_packet_len_pmt(unsigned packet_len)=0
static sptr make(size_t itemsize, unsigned int vlen, unsigned packet_len, const std::string &len_tag_key)
virtual void set_packet_len(unsigned packet_len)=0
std::shared_ptr< stream_to_tagged_stream > sptr
Definition: stream_to_tagged_stream.h:36
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GR_RUNTIME_API size_t itemsize(types::vector_type type)
GNU Radio logging wrapper.
Definition: basic_block.h:29