Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_top_block.cc
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007 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
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include <unistd.h>
28 #include <gr_top_block.h>
29 #include <gr_top_block_impl.h>
30 #include <gr_io_signature.h>
31 #include <iostream>
32
33 gr_top_block_sptr 
34 gr_make_top_block(const std::string &name)
35 {
36   return gnuradio::get_initial_sptr(new gr_top_block(name));
37 }
38
39 gr_top_block::gr_top_block(const std::string &name)
40   : gr_hier_block2(name, 
41                    gr_make_io_signature(0,0,0), 
42                    gr_make_io_signature(0,0,0))
43   
44 {
45   d_impl = new gr_top_block_impl(this);
46 }
47   
48 gr_top_block::~gr_top_block()
49 {
50   stop();
51   wait();
52     
53   delete d_impl;
54 }
55
56 void 
57 gr_top_block::start()
58 {
59   d_impl->start();
60 }
61
62 void 
63 gr_top_block::stop()
64 {
65   d_impl->stop();
66 }
67
68 void 
69 gr_top_block::wait()
70 {
71   d_impl->wait();
72 }
73
74 void 
75 gr_top_block::run()
76 {
77   start();
78   wait();
79 }
80
81 void
82 gr_top_block::lock()
83 {
84   d_impl->lock();
85 }
86
87 void
88 gr_top_block::unlock()
89 {
90   d_impl->unlock();
91 }
92
93 void
94 gr_top_block::dump()
95 {
96   d_impl->dump();
97 }