GNU Radio Manual and C++ API Reference  3.10.4.0
The Free & Open Software Radio Ecosystem
io_signature.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2007 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_IO_SIGNATURE_H
12 #define INCLUDED_IO_SIGNATURE_H
13 
14 #include <functional>
15 
16 #include <gnuradio/api.h>
18 #include <gnuradio/buffer_type.h>
19 #include <gnuradio/runtime_types.h>
20 
21 namespace gr {
22 
23 /*!
24  * \brief i/o signature for input and output ports.
25  * \brief misc
26  */
28 {
29  int d_min_streams;
30  int d_max_streams;
31  std::vector<int> d_sizeof_stream_item;
32  gr_vector_buffer_type d_stream_buffer_type;
33 
34  io_signature(int min_streams,
35  int max_streams,
36  const std::vector<int>& sizeof_stream_items,
37  gr_vector_buffer_type buftypes);
38 
39 public:
40  typedef std::shared_ptr<io_signature> sptr;
41 
42  static constexpr int IO_INFINITE = -1;
43 
45 
46  /*!
47  * \brief Create an i/o signature
48  *
49  * \ingroup internal
50  * \param min_streams specify minimum number of streams (>= 0)
51  * \param max_streams specify maximum number of streams (>= min_streams or -1 ->
52  * infinite) \param sizeof_stream_item specify the size of the items in each stream
53  * \param buftype type of buffers the streams should use (defaults to standard host
54  * double mapped buffer)
55  */
56  static sptr make(int min_streams,
57  int max_streams,
58  int sizeof_stream_item,
60 
61  /*!
62  * \brief Create an i/o signature
63  *
64  * \param min_streams specify minimum number of streams (>= 0)
65  * \param max_streams specify maximum number of streams (>= min_streams or -1 ->
66  * infinite) \param sizeof_stream_item1 specify the size of the items in the first
67  * stream \param sizeof_stream_item2 specify the size of the items in the second and
68  * subsequent streams
69  * \param buftype1 type of buffers the first stream should use (defaults to standard
70  * host double mapped buffer)
71  * \param buftype2 type of buffers the second and subsequent streams should use
72  * (defaults to standard host double mapped buffer)
73  */
74  static sptr make2(int min_streams,
75  int max_streams,
76  int sizeof_stream_item1,
77  int sizeof_stream_item2,
80 
81  /*!
82  * \brief Create an i/o signature
83  *
84  * \param min_streams specify minimum number of streams (>= 0)
85  * \param max_streams specify maximum number of streams (>= min_streams or -1 ->
86  * infinite) \param sizeof_stream_item1 specify the size of the items in the first
87  * stream \param sizeof_stream_item2 specify the size of the items in the second
88  * stream \param sizeof_stream_item3 specify the size of the items in the third and
89  * subsequent streams
90  * \param buftype1 type of buffers the first stream should use (defaults to standard
91  * host double mapped buffer)
92  * \param buftype2 type of buffers the second stream should use (defaults to standard
93  * host double mapped buffer)
94  * \param buftype3 type of buffers the third and subsequent streams should use
95  * (defaults to standard host double mapped buffer)
96  */
97  static sptr make3(int min_streams,
98  int max_streams,
99  int sizeof_stream_item1,
100  int sizeof_stream_item2,
101  int sizeof_stream_item3,
105 
106  /*!
107  * \brief Create an i/o signature
108  *
109  * \param min_streams specify minimum number of streams (>= 0)
110  * \param max_streams specify maximum number of streams (>= min_streams or -1 ->
111  * infinite) \param sizeof_stream_items specify the size of the items in the streams
112  *
113  * If there are more streams than there are entries in
114  * sizeof_stream_items, the value of the last entry in
115  * sizeof_stream_items is used for the missing values.
116  * sizeof_stream_items must contain at least 1 entry.
117  */
118  static sptr
119  makev(int min_streams, int max_streams, const std::vector<int>& sizeof_stream_items);
120 
121  /*!
122  * \brief Create an i/o signature
123  *
124  * \param min_streams specify minimum number of streams (>= 0)
125  * \param max_streams specify maximum number of streams (>= min_streams or -1 ->
126  * infinite)
127  * \param sizeof_stream_items specify the size of the items in the streams
128  * \param buftypes the type of buffer each stream will should use
129  *
130  * If there are more streams than there are entries in
131  * sizeof_stream_items, the value of the last entry in
132  * sizeof_stream_items is used for the missing values.
133  * sizeof_stream_items must contain at least 1 entry.
134  */
135  static sptr makev(int min_streams,
136  int max_streams,
137  const std::vector<int>& sizeof_stream_items,
138  gr_vector_buffer_type buftypes);
139 
140  int min_streams() const { return d_min_streams; }
141  int max_streams() const { return d_max_streams; }
142  int sizeof_stream_item(int index) const;
143  std::vector<int> sizeof_stream_items() const;
144  buffer_type stream_buffer_type(size_t index) const;
146 };
147 
148 } /* namespace gr */
149 
150 #endif /* INCLUDED_IO_SIGNATURE_H */
static buffer_type type
Definition: buffer_double_mapped.h:31
Base class for describing a buffer's type.
Definition: buffer_type.h:30
i/o signature for input and output ports.
Definition: io_signature.h:28
int min_streams() const
Definition: io_signature.h:140
int sizeof_stream_item(int index) const
static sptr make3(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2, int sizeof_stream_item3, buffer_type buftype1=buffer_double_mapped::type, buffer_type buftype2=buffer_double_mapped::type, buffer_type buftype3=buffer_double_mapped::type)
Create an i/o signature.
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:40
static sptr make2(int min_streams, int max_streams, int sizeof_stream_item1, int sizeof_stream_item2, buffer_type buftype1=buffer_double_mapped::type, buffer_type buftype2=buffer_double_mapped::type)
Create an i/o signature.
gr_vector_buffer_type stream_buffer_types() const
static sptr makev(int min_streams, int max_streams, const std::vector< int > &sizeof_stream_items)
Create an i/o signature.
buffer_type stream_buffer_type(size_t index) const
int max_streams() const
Definition: io_signature.h:141
static sptr makev(int min_streams, int max_streams, const std::vector< int > &sizeof_stream_items, gr_vector_buffer_type buftypes)
Create an i/o signature.
std::vector< int > sizeof_stream_items() const
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
static sptr make(int min_streams, int max_streams, int sizeof_stream_item, buffer_type buftype=buffer_double_mapped::type)
Create an i/o signature.
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< std::reference_wrapper< const buffer_type_base > > gr_vector_buffer_type
Definition: buffer_type.h:88
Template used to create buffer types. Note that the factory_class parameter must contain a static fun...
Definition: buffer_type.h:96