3 * Copyright 2004,2008 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
23 #ifndef INCLUDED_GR_BLOCK_EXECUTOR_H
24 #define INCLUDED_GR_BLOCK_EXECUTOR_H
26 #include <gr_runtime_types.h>
29 //class gr_block_executor;
30 //typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr;
34 * \brief Manage the execution of a single block.
38 class gr_block_executor {
40 gr_block_sptr d_block; // The block we're trying to run
43 // These are allocated here so we don't have to on each iteration
45 gr_vector_int d_ninput_items_required;
46 gr_vector_int d_ninput_items;
47 gr_vector_const_void_star d_input_items;
48 std::vector<bool> d_input_done;
49 gr_vector_void_star d_output_items;
52 gr_block_executor(gr_block_sptr block);
53 ~gr_block_executor ();
56 READY, // We made progress; everything's cool.
57 READY_NO_OUTPUT, // We consumed some input, but produced no output.
58 BLKD_IN, // no progress; we're blocked waiting for input data.
59 BLKD_OUT, // no progress; we're blocked waiting for output buffer space.
60 DONE, // we're done; don't call me again.
64 * \brief Run one iteration.
66 state run_one_iteration();
69 #endif /* INCLUDED_GR_BLOCK_EXECUTOR_H */