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