GNU Radio 3.6.4 C++ API
gr_hier_block2_detail.h
Go to the documentation of this file.
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_core_api.h>
26 #include <gr_hier_block2.h>
27 #include <gr_flat_flowgraph.h>
28 #include <boost/utility.hpp>
29 
30 /*!
31  * \ingroup internal
32  */
33 class GR_CORE_API gr_hier_block2_detail : boost::noncopyable
34 {
35 public:
38 
39  void connect(gr_basic_block_sptr block);
40  void connect(gr_basic_block_sptr src, int src_port,
41  gr_basic_block_sptr dst, int dst_port);
42  void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport,
43  gr_basic_block_sptr dst, pmt::pmt_t dstport);
44  void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport,
45  gr_basic_block_sptr dst, pmt::pmt_t dstport);
46  void disconnect(gr_basic_block_sptr block);
47  void disconnect(gr_basic_block_sptr, int src_port,
48  gr_basic_block_sptr, int dst_port);
49  void disconnect_all();
50  void lock();
51  void unlock();
52  void flatten_aux(gr_flat_flowgraph_sptr sfg) const;
53 
54 private:
55 
56  // Private implementation data
57  gr_hier_block2 *d_owner;
58  gr_hier_block2_detail *d_parent_detail;
59  gr_flowgraph_sptr d_fg;
60  std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input
61  gr_endpoint_vector_t d_outputs; // Single internal endpoint per external output
62  gr_basic_block_vector_t d_blocks;
63 
64 
65  void connect_input(int my_port, int port, gr_basic_block_sptr block);
66  void connect_output(int my_port, int port, gr_basic_block_sptr block);
67  void disconnect_input(int my_port, int port, gr_basic_block_sptr block);
68  void disconnect_output(int my_port, int port, gr_basic_block_sptr block);
69 
70  gr_endpoint_vector_t resolve_port(int port, bool is_input);
71  gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool is_input) const;
72 };
73 
74 #endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */