GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
vector_source_s.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004,2008,2012-2013 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// WARNING: this file is machine generated. Edits will be overwritten
24
25#ifndef INCLUDED_BLOCKS_VECTOR_SOURCE_S_H
26#define INCLUDED_BLOCKS_VECTOR_SOURCE_S_H
27
28#include <gnuradio/blocks/api.h>
29#include <gnuradio/sync_block.h>
30
31namespace gr {
32 namespace blocks {
33
34 /*!
35 * \brief Source that streams short items based on the input \p data vector.
36 * \ingroup misc_blk
37 *
38 * \details
39 * This block produces a stream of samples based on an input
40 * vector. In C++, this is a std::vector<short>, and in Python,
41 * this is either a list or tuple. The data can repeat infinitely
42 * until the flowgraph is terminated by some other event or, the
43 * default, run the data once and stop.
44 *
45 * The vector source can also produce stream tags with the
46 * data. Pass in a vector of gr::tag_t objects and they will be
47 * emitted based on the specified offset of the tag.
48 *
49 * GNU Radio provides a utility Python module in gr.tag_utils to
50 * convert between tags and Python objects:
51 * gr.tag_utils.python_to_tag.
52 *
53 * We can create tags as Python lists (or tuples) using the list
54 * structure [int offset, pmt key, pmt value, pmt srcid]. It is
55 * important to define the list/tuple with the values in the
56 * correct order and with the correct data type. A python
57 * dictionary can also be used using the keys: "offset", "key",
58 * "value", and "srcid" with the same data types as for the lists.
59 *
60 * When given a list of tags, the vector source will emit the tags
61 * repeatedly by updating the offset relative to the vector stream
62 * length. That is, if the vector has 500 items and a tag has an
63 * offset of 0, that tag will be placed on item 0, 500, 1000,
64 * 1500, etc.
65 */
66 class BLOCKS_API vector_source_s : virtual public sync_block
67 {
68 public:
69 // gr::blocks::vector_source_s::sptr
70 typedef boost::shared_ptr<vector_source_s> sptr;
71
72 static sptr make(const std::vector<short> &data,
73 bool repeat=false, int vlen=1,
74 const std::vector<tag_t> &tags=std::vector<tag_t>());
75
76 virtual void rewind() = 0;
77 virtual void set_data(const std::vector<short> &data,
78 const std::vector<tag_t> &tags=std::vector<tag_t>()) = 0;
79 virtual void set_repeat(bool repeat) = 0;
80 };
81
82 } /* namespace blocks */
83} /* namespace gr */
84
85#endif /* INCLUDED_BLOCKS_VECTOR_SOURCE_S_H */
repeat each input repeat times
Definition: repeat.h:42
Source that streams short items based on the input data vector.
Definition: vector_source_s.h:67
virtual void set_data(const std::vector< short > &data, const std::vector< tag_t > &tags=std::vector< tag_t >())=0
boost::shared_ptr< vector_source_s > sptr
Definition: vector_source_s.h:70
virtual void set_repeat(bool repeat)=0
static sptr make(const std::vector< short > &data, bool repeat=false, int vlen=1, const std::vector< tag_t > &tags=std::vector< tag_t >())
synchronous 1:1 input to output with history
Definition: sync_block.h:38
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
Include this header to use the message passing features.
Definition: basic_block.h:45