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