GNU Radio 3.4.0 C++ API
gr_io_signature.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004,2007 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_IO_SIGNATURE_H
00024 #define INCLUDED_IO_SIGNATURE_H
00025 
00026 #include <gr_runtime_types.h>
00027 
00028 /*!
00029  * \brief Create an i/o signature
00030  *
00031  * \ingroup internal
00032  * \param min_streams  specify minimum number of streams (>= 0)
00033  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00034  * \param sizeof_stream_item  specify the size of the items in each stream
00035  */
00036 gr_io_signature_sptr
00037 gr_make_io_signature(int min_streams, int max_streams,
00038                      int sizeof_stream_item);
00039 
00040 /*!
00041  * \brief Create an i/o signature
00042  *
00043  * \param min_streams  specify minimum number of streams (>= 0)
00044  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00045  * \param sizeof_stream_item1 specify the size of the items in the first stream
00046  * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
00047  */
00048 gr_io_signature_sptr
00049 gr_make_io_signature2(int min_streams, int max_streams,
00050                       int sizeof_stream_item1,
00051                       int sizeof_stream_item2
00052                       );
00053 
00054 /*!
00055  * \brief Create an i/o signature
00056  *
00057  * \param min_streams  specify minimum number of streams (>= 0)
00058  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00059  * \param sizeof_stream_item1 specify the size of the items in the first stream
00060  * \param sizeof_stream_item2 specify the size of the items in the second stream
00061  * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
00062  */
00063 gr_io_signature_sptr
00064 gr_make_io_signature3(int min_streams, int max_streams, 
00065                       int sizeof_stream_item1,
00066                       int sizeof_stream_item2,
00067                       int sizeof_stream_item3
00068                       );
00069 
00070 /*!
00071  * \brief Create an i/o signature
00072  *
00073  * \param min_streams  specify minimum number of streams (>= 0)
00074  * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00075  * \param sizeof_stream_items specify the size of the items in the streams
00076  *
00077  * If there are more streams than there are entries in sizeof_stream_items, the
00078  * value of the last entry in sizeof_stream_items is used for the missing values.
00079  * sizeof_stream_items must contain at least 1 entry.
00080  */
00081 gr_io_signature_sptr
00082 gr_make_io_signaturev(int min_streams, int max_streams,
00083                       const std::vector<int> &sizeof_stream_items);
00084 
00085 
00086 /*!
00087  * \brief i/o signature for input and output ports.
00088  * \brief misc
00089  */
00090 class gr_io_signature {
00091   int                   d_min_streams;
00092   int                   d_max_streams;
00093   std::vector<int>      d_sizeof_stream_item;
00094 
00095   gr_io_signature(int min_streams, int max_streams,
00096                   const std::vector<int> &sizeof_stream_items);
00097 
00098   friend gr_io_signature_sptr 
00099   gr_make_io_signaturev(int min_streams,
00100                         int max_streams,
00101                         const std::vector<int> &sizeof_stream_items);
00102 
00103  public:
00104 
00105   static const int IO_INFINITE = -1;
00106     
00107   ~gr_io_signature ();
00108     
00109   int min_streams () const { return d_min_streams; }
00110   int max_streams () const { return d_max_streams; }
00111   int sizeof_stream_item (int index) const;
00112   std::vector<int> sizeof_stream_items() const;
00113 };
00114 
00115 
00116 #endif /* INCLUDED_IO_SIGNATURE_H */