Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 6e7a2755bd78c9deedab199b86e675f3 > files > 3732

gnuradio-doc-3.2.2-9.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>GNU Radio 3.2.2 C++ API: gr_basic_block.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">GNU Radio 3.2.2 C++ API</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('gr__basic__block_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>gr_basic_block.h</h1>  </div>
</div>
<div class="contents">
<a href="gr__basic__block_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c++ -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/*</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright 2006,2008 Free Software Foundation, Inc.</span>
<a name="l00004"></a>00004 <span class="comment"> * </span>
<a name="l00005"></a>00005 <span class="comment"> * This file is part of GNU Radio</span>
<a name="l00006"></a>00006 <span class="comment"> * </span>
<a name="l00007"></a>00007 <span class="comment"> * GNU Radio is free software; you can redistribute it and/or modify</span>
<a name="l00008"></a>00008 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00009"></a>00009 <span class="comment"> * the Free Software Foundation; either version 3, or (at your option)</span>
<a name="l00010"></a>00010 <span class="comment"> * any later version.</span>
<a name="l00011"></a>00011 <span class="comment"> * </span>
<a name="l00012"></a>00012 <span class="comment"> * GNU Radio is distributed in the hope that it will be useful,</span>
<a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00015"></a>00015 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00016"></a>00016 <span class="comment"> * </span>
<a name="l00017"></a>00017 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00018"></a>00018 <span class="comment"> * along with GNU Radio; see the file COPYING.  If not, write to</span>
<a name="l00019"></a>00019 <span class="comment"> * the Free Software Foundation, Inc., 51 Franklin Street,</span>
<a name="l00020"></a>00020 <span class="comment"> * Boston, MA 02110-1301, USA.</span>
<a name="l00021"></a>00021 <span class="comment"> */</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef INCLUDED_GR_BASIC_BLOCK_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDED_GR_BASIC_BLOCK_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;<a class="code" href="gr__runtime__types_8h.html">gr_runtime_types.h</a>&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;<a class="code" href="gr__sptr__magic_8h.html">gr_sptr_magic.h</a>&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;boost/enable_shared_from_this.hpp&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">/*!</span>
<a name="l00032"></a>00032 <span class="comment"> * \brief The abstract base class for all signal processing blocks.</span>
<a name="l00033"></a>00033 <span class="comment"> * \ingroup internal</span>
<a name="l00034"></a>00034 <span class="comment"> *</span>
<a name="l00035"></a>00035 <span class="comment"> * Basic blocks are the bare abstraction of an entity that has a name</span>
<a name="l00036"></a>00036 <span class="comment"> * and a set of inputs and outputs.  These are never instantiated</span>
<a name="l00037"></a>00037 <span class="comment"> * directly; rather, this is the abstract parent class of both gr_hier_block,</span>
<a name="l00038"></a>00038 <span class="comment"> * which is a recursive container, and gr_block, which implements actual</span>
<a name="l00039"></a>00039 <span class="comment"> * signal processing functions.</span>
<a name="l00040"></a>00040 <span class="comment"> */</span>
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="classgr__basic__block.html">00042</a> <span class="keyword">class </span><a class="code" href="classgr__basic__block.html" title="The abstract base class for all signal processing blocks.Basic blocks are the bare abstraction of an ...">gr_basic_block</a> : <span class="keyword">public</span> boost::enable_shared_from_this&lt;gr_basic_block&gt;
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keyword">protected</span>:
<a name="l00045"></a><a class="code" href="classgr__basic__block.html#adf5bf4523d6dd698aa770e3da8f2b30d">00045</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgr__flowgraph.html" title="Class representing a directed, acyclic graph of basic blocks.">gr_flowgraph</a>;
<a name="l00046"></a><a class="code" href="classgr__basic__block.html#a69b41e361328cea911d69e1ec0bc50ff">00046</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgr__flat__flowgraph.html" title="Class specializing gr_flat_flowgraph that has all nodes as gr_blocks, with no hierarchy.">gr_flat_flowgraph</a>; <span class="comment">// TODO: will be redundant</span>
<a name="l00047"></a>00047 
<a name="l00048"></a><a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3da476d594a077e729bad0f2cfa2008c899">00048</a>     <span class="keyword">enum</span> <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3d">vcolor</a> { <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3da476d594a077e729bad0f2cfa2008c899">WHITE</a>, <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3daa6cce7ec34a3f9cf917e545a743dc89f">GREY</a>, <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3da0abd1c82699481ffa502e5bb8d7bdaec">BLACK</a> };
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="classgr__basic__block.html#afd352cc073ef28012d4d079a863f5401">00050</a>     std::string          <a class="code" href="classgr__basic__block.html#afd352cc073ef28012d4d079a863f5401">d_name</a>;
<a name="l00051"></a><a class="code" href="classgr__basic__block.html#a2c8da0c28bbbfb0e759278c9b9459e96">00051</a>     <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#a2c8da0c28bbbfb0e759278c9b9459e96">d_input_signature</a>;
<a name="l00052"></a><a class="code" href="classgr__basic__block.html#a76d64ed7a79566e3310306ae6f194d75">00052</a>     <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#a76d64ed7a79566e3310306ae6f194d75">d_output_signature</a>;
<a name="l00053"></a><a class="code" href="classgr__basic__block.html#a0d2999c04f47327f93dd7def5dc704f8">00053</a>     <span class="keywordtype">long</span>                 <a class="code" href="classgr__basic__block.html#a0d2999c04f47327f93dd7def5dc704f8">d_unique_id</a>;
<a name="l00054"></a><a class="code" href="classgr__basic__block.html#a7fb7e692e3b98a82410b396ef263bb41">00054</a>     <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3d">vcolor</a>               <a class="code" href="classgr__basic__block.html#a7fb7e692e3b98a82410b396ef263bb41">d_color</a>;
<a name="l00055"></a>00055 <span class="comment"></span>
<a name="l00056"></a>00056 <span class="comment">    //! Protected constructor prevents instantiation by non-derived classes</span>
<a name="l00057"></a>00057 <span class="comment"></span>    <a class="code" href="classgr__basic__block.html#a1183eee484f58953a2fed4c792e46245" title="Protected constructor prevents instantiation by non-derived classes.">gr_basic_block</a>(<span class="keyword">const</span> std::string &amp;<a class="code" href="classgr__basic__block.html#aa12a20d8b8eab341da935530d29299d2">name</a>,
<a name="l00058"></a>00058                    <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#a58f6d05e85931200f3771d3e50741281">input_signature</a>,
<a name="l00059"></a>00059                    <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#add68b96f012dfe352700b4fd1c3a184a">output_signature</a>);
<a name="l00060"></a>00060 <span class="comment"></span>
<a name="l00061"></a>00061 <span class="comment">    //! may only be called during constructor</span>
<a name="l00062"></a><a class="code" href="classgr__basic__block.html#a419d0fbba0ca02d822cbc299b979de54">00062</a> <span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="classgr__basic__block.html#a419d0fbba0ca02d822cbc299b979de54" title="may only be called during constructor">set_input_signature</a>(<a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> iosig) {
<a name="l00063"></a>00063         <a class="code" href="classgr__basic__block.html#a2c8da0c28bbbfb0e759278c9b9459e96">d_input_signature</a> = iosig;
<a name="l00064"></a>00064     }
<a name="l00065"></a>00065     <span class="comment"></span>
<a name="l00066"></a>00066 <span class="comment">    //! may only be called during constructor</span>
<a name="l00067"></a><a class="code" href="classgr__basic__block.html#a949b6ad69ebfdf423835265db99cf63d">00067</a> <span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="classgr__basic__block.html#a949b6ad69ebfdf423835265db99cf63d" title="may only be called during constructor">set_output_signature</a>(<a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> iosig) {
<a name="l00068"></a>00068         <a class="code" href="classgr__basic__block.html#a76d64ed7a79566e3310306ae6f194d75">d_output_signature</a> = iosig;
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">    /*!</span>
<a name="l00072"></a>00072 <span class="comment">     * \brief Allow the flowgraph to set for sorting and partitioning</span>
<a name="l00073"></a>00073 <span class="comment">     */</span>
<a name="l00074"></a><a class="code" href="classgr__basic__block.html#a0821ef947158670d53bf0739f3c8877b">00074</a>     <span class="keywordtype">void</span> <a class="code" href="classgr__basic__block.html#a0821ef947158670d53bf0739f3c8877b" title="Allow the flowgraph to set for sorting and partitioning.">set_color</a>(<a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3d">vcolor</a> <a class="code" href="classgr__basic__block.html#a1cedb1704b6c00977c681b378ede384c">color</a>) { <a class="code" href="classgr__basic__block.html#a7fb7e692e3b98a82410b396ef263bb41">d_color</a> = <a class="code" href="classgr__basic__block.html#a1cedb1704b6c00977c681b378ede384c">color</a>; }
<a name="l00075"></a><a class="code" href="classgr__basic__block.html#a1cedb1704b6c00977c681b378ede384c">00075</a>     <a class="code" href="classgr__basic__block.html#a5c90b7c003ddd61f8df6bef2aceeab3d">vcolor</a> <a class="code" href="classgr__basic__block.html#a1cedb1704b6c00977c681b378ede384c">color</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classgr__basic__block.html#a7fb7e692e3b98a82410b396ef263bb41">d_color</a>; }
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="keyword">public</span>:
<a name="l00078"></a>00078     <span class="keyword">virtual</span> <a class="code" href="classgr__basic__block.html#a5bc14d27d53b7b57a960a47cc255e3f9">~gr_basic_block</a>();
<a name="l00079"></a><a class="code" href="classgr__basic__block.html#aa2a2947744d418c5470fbf4e623b58fe">00079</a>     <span class="keywordtype">long</span> <a class="code" href="classgr__basic__block.html#aa2a2947744d418c5470fbf4e623b58fe">unique_id</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classgr__basic__block.html#a0d2999c04f47327f93dd7def5dc704f8">d_unique_id</a>; }
<a name="l00080"></a><a class="code" href="classgr__basic__block.html#aa12a20d8b8eab341da935530d29299d2">00080</a>     std::string <a class="code" href="classgr__basic__block.html#aa12a20d8b8eab341da935530d29299d2">name</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classgr__basic__block.html#afd352cc073ef28012d4d079a863f5401">d_name</a>; }
<a name="l00081"></a><a class="code" href="classgr__basic__block.html#a58f6d05e85931200f3771d3e50741281">00081</a>     <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#a58f6d05e85931200f3771d3e50741281">input_signature</a>()<span class="keyword"> const  </span>{ <span class="keywordflow">return</span> <a class="code" href="classgr__basic__block.html#a2c8da0c28bbbfb0e759278c9b9459e96">d_input_signature</a>; }
<a name="l00082"></a><a class="code" href="classgr__basic__block.html#add68b96f012dfe352700b4fd1c3a184a">00082</a>     <a class="code" href="classboost_1_1shared__ptr.html">gr_io_signature_sptr</a> <a class="code" href="classgr__basic__block.html#add68b96f012dfe352700b4fd1c3a184a">output_signature</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classgr__basic__block.html#a76d64ed7a79566e3310306ae6f194d75">d_output_signature</a>; }
<a name="l00083"></a>00083     <a class="code" href="classboost_1_1shared__ptr.html">gr_basic_block_sptr</a> <a class="code" href="classgr__basic__block.html#a2503eb6922db0bf2a442dcd2d14670c9">basic_block</a>(); <span class="comment">// Needed for Python type coercion</span>
<a name="l00084"></a>00084 <span class="comment"></span>
<a name="l00085"></a>00085 <span class="comment">    /*!</span>
<a name="l00086"></a>00086 <span class="comment">     * \brief Confirm that ninputs and noutputs is an acceptable combination.</span>
<a name="l00087"></a>00087 <span class="comment">     *</span>
<a name="l00088"></a>00088 <span class="comment">     * \param ninputs   number of input streams connected</span>
<a name="l00089"></a>00089 <span class="comment">     * \param noutputs  number of output streams connected</span>
<a name="l00090"></a>00090 <span class="comment">     *</span>
<a name="l00091"></a>00091 <span class="comment">     * \returns true if this is a valid configuration for this block.</span>
<a name="l00092"></a>00092 <span class="comment">     *</span>
<a name="l00093"></a>00093 <span class="comment">     * This function is called by the runtime system whenever the</span>
<a name="l00094"></a>00094 <span class="comment">     * topology changes.  Most classes do not need to override this.</span>
<a name="l00095"></a>00095 <span class="comment">     * This check is in addition to the constraints specified by the input</span>
<a name="l00096"></a>00096 <span class="comment">     * and output gr_io_signatures.</span>
<a name="l00097"></a>00097 <span class="comment">     */</span>
<a name="l00098"></a><a class="code" href="classgr__basic__block.html#a50a714df9c3ce8c03854a09ac84e589b">00098</a>     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classgr__basic__block.html#a50a714df9c3ce8c03854a09ac84e589b" title="Confirm that ninputs and noutputs is an acceptable combination.">check_topology</a>(<span class="keywordtype">int</span> ninputs, <span class="keywordtype">int</span> noutputs) { <span class="keywordflow">return</span> <span class="keyword">true</span>; }
<a name="l00099"></a>00099 };
<a name="l00100"></a>00100 
<a name="l00101"></a><a class="code" href="gr__basic__block_8h.html#afe7684d11bda1c7330f6f32251f5a447">00101</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="gr__basic__block_8h.html#afe7684d11bda1c7330f6f32251f5a447">operator&lt;</a>(<a class="code" href="classboost_1_1shared__ptr.html">gr_basic_block_sptr</a> lhs, <a class="code" href="classboost_1_1shared__ptr.html">gr_basic_block_sptr</a> rhs)
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103   <span class="keywordflow">return</span> lhs-&gt;unique_id() &lt; rhs-&gt;unique_id();
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105 
<a name="l00106"></a><a class="code" href="gr__basic__block_8h.html#a76d2f45845faaf2d72b0002ba045c0d6">00106</a> <span class="keyword">typedef</span> <a class="code" href="classstd_1_1vector.html">std::vector&lt;gr_basic_block_sptr&gt;</a> <a class="code" href="gr__basic__block_8h.html#a76d2f45845faaf2d72b0002ba045c0d6">gr_basic_block_vector_t</a>;
<a name="l00107"></a><a class="code" href="gr__basic__block_8h.html#aae6b0ac6b0a67267a5bf7a6bd9a73259">00107</a> <span class="keyword">typedef</span> <a class="code" href="classstd_1_1vector.html" title="vector documentation stub">std::vector&lt;gr_basic_block_sptr&gt;::iterator</a> <a class="code" href="gr__basic__block_8h.html#aae6b0ac6b0a67267a5bf7a6bd9a73259">gr_basic_block_viter_t</a>;
<a name="l00108"></a>00108 
<a name="l00109"></a>00109 <span class="keywordtype">long</span> <a class="code" href="gr__basic__block_8h.html#a62dc14248d7bb24ca11d64e65dad30d4">gr_basic_block_ncurrently_allocated</a>();
<a name="l00110"></a>00110 
<a name="l00111"></a><a class="code" href="gr__basic__block_8h.html#acb2f610728a7f3cbd51a9a2eb60f059e">00111</a> <span class="keyword">inline</span> std::ostream &amp;<a class="code" href="gr__basic__block_8h.html#acb2f610728a7f3cbd51a9a2eb60f059e">operator &lt;&lt; </a>(std::ostream &amp;os, <a class="code" href="classboost_1_1shared__ptr.html">gr_basic_block_sptr</a> basic_block)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113     os &lt;&lt; basic_block-&gt;name() &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; basic_block-&gt;unique_id() &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00114"></a>00114     <span class="keywordflow">return</span> os;
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <span class="preprocessor">#endif </span><span class="comment">/* INCLUDED_GR_BASIC_BLOCK_H */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="gr__basic__block_8h.html">gr_basic_block.h</a>      </li>
      <li class="footer">Generated on Thu Feb 17 2011 for GNU Radio 3.2.2 C++ API by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>