Updated license from GPL version 2 or later to GPL version 3 or later.
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_io_signature.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2007 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 #ifndef INCLUDED_IO_SIGNATURE_H
24 #define INCLUDED_IO_SIGNATURE_H
25
26 #include <gr_runtime_types.h>
27
28 /*!
29  * \brief Create an i/o signature
30  *
31  * \param min_streams  specify minimum number of streams (>= 0)
32  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
33  * \param sizeof_stream_item  specify the size of the items in each stream
34  */
35 gr_io_signature_sptr
36 gr_make_io_signature(int min_streams, int max_streams,
37                      int sizeof_stream_item);
38
39 /*!
40  * \brief Create an i/o signature
41  *
42  * \param min_streams  specify minimum number of streams (>= 0)
43  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
44  * \param sizeof_stream_item1 specify the size of the items in the first stream
45  * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
46  */
47 gr_io_signature_sptr
48 gr_make_io_signature2(int min_streams, int max_streams,
49                       int sizeof_stream_item1,
50                       int sizeof_stream_item2
51                       );
52
53 /*!
54  * \brief Create an i/o signature
55  *
56  * \param min_streams  specify minimum number of streams (>= 0)
57  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
58  * \param sizeof_stream_item1 specify the size of the items in the first stream
59  * \param sizeof_stream_item2 specify the size of the items in the second stream
60  * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
61  */
62 gr_io_signature_sptr
63 gr_make_io_signature3(int min_streams, int max_streams, 
64                       int sizeof_stream_item1,
65                       int sizeof_stream_item2,
66                       int sizeof_stream_item3
67                       );
68
69 /*!
70  * \brief Create an i/o signature
71  *
72  * \param min_streams  specify minimum number of streams (>= 0)
73  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
74  * \param sizeof_stream_items specify the size of the items in the streams
75  *
76  * If there are more streams than there are entries in sizeof_stream_items, the
77  * value of the last entry in sizeof_stream_items is used for the missing values.
78  * sizeof_stream_items must contain at least 1 entry.
79  */
80 gr_io_signature_sptr
81 gr_make_io_signaturev(int min_streams, int max_streams,
82                       const std::vector<int> &sizeof_stream_items);
83
84
85 /*!
86  * \brief i/o signature for input and output ports.
87  */
88 class gr_io_signature {
89   int                   d_min_streams;
90   int                   d_max_streams;
91   std::vector<int>      d_sizeof_stream_item;
92
93   gr_io_signature(int min_streams, int max_streams,
94                   const std::vector<int> &sizeof_stream_items);
95
96   friend gr_io_signature_sptr 
97   gr_make_io_signaturev(int min_streams,
98                         int max_streams,
99                         const std::vector<int> &sizeof_stream_item);
100
101  public:
102
103   static const int IO_INFINITE = -1;
104     
105   ~gr_io_signature ();
106     
107   int min_streams () const { return d_min_streams; }
108   int max_streams () const { return d_max_streams; }
109   int sizeof_stream_item (int index) const;
110   std::vector<int> sizeof_stream_items() const;
111 };
112
113
114 #endif /* INCLUDED_IO_SIGNATURE_H */