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