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