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