3 * Copyright 2006,2008,2009 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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef INCLUDED_MB_RUNTIME_H
22 #define INCLUDED_MB_RUNTIME_H
24 #include <mblock/common.h>
25 #include <gnuradio/omnithread.h>
28 * \brief Public constructor (factory) for mb_runtime objects.
30 mb_runtime_sptr mb_make_runtime();
33 * \brief Abstract runtime support for m-blocks
35 * There should generally be only a single instance of this class.
37 class mb_runtime : boost::noncopyable,
38 public boost::enable_shared_from_this<mb_runtime>
45 virtual ~mb_runtime();
48 * \brief Construct and run the specified mblock hierarchy.
50 * This routine turns into the m-block scheduler, and
51 * blocks until the system is shutdown.
53 * \param instance_name name of the top-level mblock (conventionally "top")
54 * \param class_name The class of the top-level mblock to create.
55 * \param user_arg The argument to pass to the top-level mblock constructor
56 * \param result The value passed to shutdown_all.
58 * \returns true if the system ran successfully.
60 virtual bool run(const std::string &instance_name,
61 const std::string &class_name,
63 pmt::pmt_t *result = 0) = 0;
66 mb_mblock_sptr top() { return d_top; }
69 #endif /* INCLUDED_MB_RUNTIME_H */