GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
vector_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2008,2009,2013,2018 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 
12 #ifndef VECTOR_SINK_H
13 #define VECTOR_SINK_H
14 
15 #include <gnuradio/blocks/api.h>
16 #include <gnuradio/sync_block.h>
17 #include <cstdint>
18 
19 namespace gr {
20 namespace blocks {
21 
22 /*!
23  * \brief T sink that writes to a vector
24  * \ingroup debug_tools_blk
25  */
26 template <class T>
27 class BLOCKS_API vector_sink : virtual public sync_block
28 {
29 public:
30  // gr::blocks::vector_sink::sptr
31  typedef std::shared_ptr<vector_sink<T>> sptr;
32 
33  /*!
34  * \brief Make a new instance of the vector source, and return a shared pointer to it.
35  * \param vlen length of vector items
36  * \param reserve_items reserve space in the internal storage for this many items;
37  * the internal storage will still grow to accommodate more item
38  * if necessary, but setting this to a realistic value can avoid
39  * memory allocations during runtime, especially if you know a
40  * priori how many items you're going to store.
41  */
42  static sptr make(const unsigned int vlen = 1, const int reserve_items = 1024);
43 
44  //! Clear the data and tags containers.
45  virtual void reset() = 0;
46  virtual std::vector<T> data() const = 0;
47  virtual std::vector<tag_t> tags() const = 0;
48 };
49 
55 } /* namespace blocks */
56 } /* namespace gr */
57 
58 #endif /* VECTOR_SINK_H */
T sink that writes to a vector.
Definition: vector_sink.h:28
std::shared_ptr< vector_sink< T > > sptr
Definition: vector_sink.h:31
static sptr make(const unsigned int vlen=1, const int reserve_items=1024)
Make a new instance of the vector source, and return a shared pointer to it.
virtual void reset()=0
Clear the data and tags containers.
virtual std::vector< tag_t > tags() const =0
virtual std::vector< T > data() const =0
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
vector_sink< float > vector_sink_f
Definition: vector_sink.h:53
vector_sink< gr_complex > vector_sink_c
Definition: vector_sink.h:54
vector_sink< std::int16_t > vector_sink_s
Definition: vector_sink.h:51
vector_sink< std::uint8_t > vector_sink_b
Definition: vector_sink.h:50
vector_sink< std::int32_t > vector_sink_i
Definition: vector_sink.h:52
GNU Radio logging wrapper.
Definition: basic_block.h:29