summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime/gr_top_block.h
blob: 4e4becd1fd4840ed9184ae664613719d31845ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright 2012-2013 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_GNURADIO_GR_TOP_BLOCK_H
#define INCLUDED_GNURADIO_GR_TOP_BLOCK_H

#include <gr_core_api.h>
#include <gras/top_block.hpp>
#include <gr_hier_block2.h>

struct GR_CORE_API gr_top_block : gras::TopBlock
{

    gr_top_block(void);

    gr_top_block(const std::string &name);

    long unique_id(void) const{return _unique_id;}
    std::string name(void) const{return _name;}
    long _unique_id;
    std::string _name;

    void start(const size_t max_items);

    void run(const size_t max_items);

    int max_noutput_items(void) const;

    void set_max_noutput_items(int max_items);

    void run(void);

    virtual void start(void);

    virtual void stop(void);

    virtual void wait(void);

    inline void lock(void){}

    inline void unlock(void){this->commit();}

};

typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr;

GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name);

#endif /*INCLUDED_GNURADIO_GR_TOP_BLOCK_H*/