Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_hier_block2_detail.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2007,2009 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 #ifndef INCLUDED_GR_HIER_BLOCK2_DETAIL_H
23 #define INCLUDED_GR_HIER_BLOCK2_DETAIL_H
24
25 #include <gr_hier_block2.h>
26 #include <gr_flat_flowgraph.h>
27 #include <boost/utility.hpp>
28
29 /*!
30  * \ingroup internal
31  */
32 class gr_hier_block2_detail : boost::noncopyable
33 {
34 public:
35   gr_hier_block2_detail(gr_hier_block2 *owner);
36   ~gr_hier_block2_detail();
37
38   void connect(gr_basic_block_sptr block);
39   void connect(gr_basic_block_sptr src, int src_port, 
40                gr_basic_block_sptr dst, int dst_port);
41   void disconnect(gr_basic_block_sptr block);
42   void disconnect(gr_basic_block_sptr, int src_port, 
43                   gr_basic_block_sptr, int dst_port);
44   void disconnect_all();
45   void lock();
46   void unlock();
47   void flatten_aux(gr_flat_flowgraph_sptr sfg) const;
48
49 private:
50   
51   // Private implementation data
52   gr_hier_block2 *d_owner;
53   gr_hier_block2_detail *d_parent_detail;
54   gr_flowgraph_sptr d_fg;
55   std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input
56   gr_endpoint_vector_t d_outputs;             // Single internal endpoint per external output
57   gr_basic_block_vector_t d_blocks;
58   
59   void connect_input(int my_port, int port, gr_basic_block_sptr block);
60   void connect_output(int my_port, int port, gr_basic_block_sptr block);
61   void disconnect_input(int my_port, int port, gr_basic_block_sptr block);
62   void disconnect_output(int my_port, int port, gr_basic_block_sptr block);
63
64   gr_endpoint_vector_t resolve_port(int port, bool is_input);
65   gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool is_input) const;
66 };
67
68 #endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */