GNU Radio 3.4.2 C++ API
gr_flat_flowgraph.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006,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_GR_FLAT_FLOWGRAPH_H
00024 #define INCLUDED_GR_FLAT_FLOWGRAPH_H
00025 
00026 #include <gr_flowgraph.h>
00027 #include <gr_block.h>
00028 
00029 // Create a shared pointer to a heap allocated gr_flat_flowgraph
00030 // (types defined in gr_runtime_types.h)
00031 gr_flat_flowgraph_sptr gr_make_flat_flowgraph();
00032 
00033 /*!
00034  *\brief Class specializing gr_flat_flowgraph that has all nodes
00035  * as gr_blocks, with no hierarchy
00036  * \ingroup internal
00037  */
00038 class gr_flat_flowgraph : public gr_flowgraph
00039 {
00040 public:
00041   friend gr_flat_flowgraph_sptr gr_make_flat_flowgraph();
00042 
00043   // Destruct an arbitrary gr_flat_flowgraph
00044   ~gr_flat_flowgraph();
00045 
00046   // Wire gr_blocks together in new flat_flowgraph
00047   void setup_connections();
00048 
00049   // Merge applicable connections from existing flat flowgraph
00050   void merge_connections(gr_flat_flowgraph_sptr sfg);
00051 
00052   void dump();
00053 
00054   /*!
00055    * Make a vector of gr_block from a vector of gr_basic_block
00056    */
00057   static gr_block_vector_t make_block_vector(gr_basic_block_vector_t &blocks);
00058 
00059 private:
00060   gr_flat_flowgraph();
00061 
00062   gr_block_detail_sptr allocate_block_detail(gr_basic_block_sptr block);
00063   gr_buffer_sptr allocate_buffer(gr_basic_block_sptr block, int port);
00064   void connect_block_inputs(gr_basic_block_sptr block);
00065 };
00066 
00067 #endif /* INCLUDED_GR_FLAT_FLOWGRAPH_H */