summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/include/gr_io_signature.h
blob: 345cd6b9d250dce59c4294ccb97a96827f139203 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* -*- c++ -*- */
/*
 * Copyright 2004,2007 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_IO_SIGNATURE_H
#define INCLUDED_IO_SIGNATURE_H

#include <gr_runtime_api.h>
#include <gr_runtime_types.h>

/*!
 * \brief Create an i/o signature
 *
 * \ingroup internal
 * \param min_streams  specify minimum number of streams (>= 0)
 * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
 * \param sizeof_stream_item  specify the size of the items in each stream
 */
GR_RUNTIME_API gr_io_signature_sptr
gr_make_io_signature(int min_streams, int max_streams,
		     int sizeof_stream_item);

/*!
 * \brief Create an i/o signature
 *
 * \param min_streams  specify minimum number of streams (>= 0)
 * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
 * \param sizeof_stream_item1 specify the size of the items in the first stream
 * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
 */
GR_RUNTIME_API gr_io_signature_sptr
gr_make_io_signature2(int min_streams, int max_streams,
		      int sizeof_stream_item1,
		      int sizeof_stream_item2
		      );

/*!
 * \brief Create an i/o signature
 *
 * \param min_streams  specify minimum number of streams (>= 0)
 * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
 * \param sizeof_stream_item1 specify the size of the items in the first stream
 * \param sizeof_stream_item2 specify the size of the items in the second stream
 * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
 */
GR_RUNTIME_API gr_io_signature_sptr
gr_make_io_signature3(int min_streams, int max_streams,
		      int sizeof_stream_item1,
		      int sizeof_stream_item2,
		      int sizeof_stream_item3
		      );

/*!
 * \brief Create an i/o signature
 *
 * \param min_streams  specify minimum number of streams (>= 0)
 * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
 * \param sizeof_stream_items specify the size of the items in the streams
 *
 * If there are more streams than there are entries in sizeof_stream_items, the
 * value of the last entry in sizeof_stream_items is used for the missing values.
 * sizeof_stream_items must contain at least 1 entry.
 */
GR_RUNTIME_API gr_io_signature_sptr
gr_make_io_signaturev(int min_streams, int max_streams,
		      const std::vector<int> &sizeof_stream_items);


/*!
 * \brief i/o signature for input and output ports.
 * \brief misc
 */
class GR_RUNTIME_API gr_io_signature {
  int			d_min_streams;
  int			d_max_streams;
  std::vector<int>	d_sizeof_stream_item;

  gr_io_signature(int min_streams, int max_streams,
		  const std::vector<int> &sizeof_stream_items);

  friend GR_RUNTIME_API gr_io_signature_sptr
  gr_make_io_signaturev(int min_streams,
			int max_streams,
			const std::vector<int> &sizeof_stream_items);

 public:

  static const int IO_INFINITE = -1;

  ~gr_io_signature ();

  int min_streams () const { return d_min_streams; }
  int max_streams () const { return d_max_streams; }
  int sizeof_stream_item (int index) const;
  std::vector<int> sizeof_stream_items() const;
};


#endif /* INCLUDED_IO_SIGNATURE_H */