Loading...
Searching...
No Matches
vector_sink.h
Go to the documentation of this file.
/* -*- 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 */
gr::blocks::vector_sink
T sink that writes to a vector.
Definition vector_sink.h:28
gr::blocks::vector_sink::data
virtual std::vector< T > data() const =0
gr::blocks::vector_sink::sptr
std::shared_ptr< vector_sink< T > > sptr
Definition vector_sink.h:31
gr::blocks::vector_sink::make
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.
gr::blocks::vector_sink::reset
virtual void reset()=0
Clear the data and tags containers.
gr::blocks::vector_sink::tags
virtual std::vector< tag_t > tags() const =0
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::blocks::vector_sink_f
vector_sink< float > vector_sink_f
Definition vector_sink.h:53
gr::blocks::vector_sink_c
vector_sink< gr_complex > vector_sink_c
Definition vector_sink.h:54
gr::blocks::vector_sink_s
vector_sink< std::int16_t > vector_sink_s
Definition vector_sink.h:51
gr::blocks::vector_sink_b
vector_sink< std::uint8_t > vector_sink_b
Definition vector_sink.h:50
gr::blocks::vector_sink_i
vector_sink< std::int32_t > vector_sink_i
Definition vector_sink.h:52
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_block.h