GNU Radio 3.7.1 C++ API
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 <gnuradio/api.h>
00027 #include <gnuradio/runtime_types.h>
00028 
00029 namespace gr {
00030 
00031   /*!
00032    * \brief i/o signature for input and output ports.
00033    * \brief misc
00034    */
00035   class GR_RUNTIME_API io_signature
00036   {
00037     int                 d_min_streams;
00038     int                 d_max_streams;
00039     std::vector<int>    d_sizeof_stream_item;
00040 
00041     io_signature(int min_streams, int max_streams,
00042                  const std::vector<int> &sizeof_stream_items);
00043 
00044   public:
00045     typedef boost::shared_ptr<io_signature> sptr;
00046 
00047     static const int IO_INFINITE = -1;
00048 
00049     ~io_signature();
00050 
00051     /*!
00052      * \brief Create an i/o signature
00053      *
00054      * \ingroup internal
00055      * \param min_streams  specify minimum number of streams (>= 0)
00056      * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00057      * \param sizeof_stream_item  specify the size of the items in each stream
00058      */
00059     static sptr make(int min_streams, int max_streams,
00060                      int sizeof_stream_item);
00061 
00062     /*!
00063      * \brief Create an i/o signature
00064      *
00065      * \param min_streams  specify minimum number of streams (>= 0)
00066      * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00067      * \param sizeof_stream_item1 specify the size of the items in the first stream
00068      * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
00069      */
00070     static sptr make2(int min_streams, int max_streams,
00071                       int sizeof_stream_item1,
00072                       int sizeof_stream_item2);
00073 
00074     /*!
00075      * \brief Create an i/o signature
00076      *
00077      * \param min_streams  specify minimum number of streams (>= 0)
00078      * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00079      * \param sizeof_stream_item1 specify the size of the items in the first stream
00080      * \param sizeof_stream_item2 specify the size of the items in the second stream
00081      * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
00082      */
00083     static sptr make3(int min_streams, int max_streams,
00084                       int sizeof_stream_item1,
00085                       int sizeof_stream_item2,
00086                       int sizeof_stream_item3);
00087 
00088     /*!
00089      * \brief Create an i/o signature
00090      *
00091      * \param min_streams  specify minimum number of streams (>= 0)
00092      * \param max_streams  specify maximum number of streams (>= min_streams or -1 -> infinite)
00093      * \param sizeof_stream_items specify the size of the items in the streams
00094      *
00095      * If there are more streams than there are entries in
00096      * sizeof_stream_items, the value of the last entry in
00097      * sizeof_stream_items is used for the missing values.
00098      * sizeof_stream_items must contain at least 1 entry.
00099      */
00100     static sptr makev(int min_streams, int max_streams,
00101                       const std::vector<int> &sizeof_stream_items);
00102 
00103     int min_streams() const { return d_min_streams; }
00104     int max_streams() const { return d_max_streams; }
00105     int sizeof_stream_item(int index) const;
00106     std::vector<int> sizeof_stream_items() const;
00107   };
00108 
00109 } /* namespace gr */
00110 
00111 #endif /* INCLUDED_IO_SIGNATURE_H */