GNU Radio 3.2.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2006,2008 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 #ifndef INCLUDED_MB_RUNTIME_H 00022 #define INCLUDED_MB_RUNTIME_H 00023 00024 #include <mblock/common.h> 00025 #include <gnuradio/omnithread.h> 00026 00027 /*! 00028 * \brief Public constructor (factory) for mb_runtime objects. 00029 */ 00030 mb_runtime_sptr mb_make_runtime(); 00031 00032 /*! 00033 * \brief Abstract runtime support for m-blocks 00034 * 00035 * There should generally be only a single instance of this class. 00036 */ 00037 class mb_runtime : boost::noncopyable, 00038 public boost::enable_shared_from_this<mb_runtime> 00039 { 00040 protected: 00041 mb_mblock_sptr d_top; 00042 00043 public: 00044 mb_runtime(){} 00045 virtual ~mb_runtime(); 00046 00047 /*! 00048 * \brief Construct and run the specified mblock hierarchy. 00049 * 00050 * This routine turns into the m-block scheduler, and 00051 * blocks until the system is shutdown. 00052 * 00053 * \param instance_name name of the top-level mblock (conventionally "top") 00054 * \param class_name The class of the top-level mblock to create. 00055 * \param user_arg The argument to pass to the top-level mblock constructor 00056 * \param result The value passed to shutdown_all. 00057 * 00058 * \returns true if the system ran successfully. 00059 */ 00060 virtual bool run(const std::string &instance_name, 00061 const std::string &class_name, 00062 pmt_t user_arg, 00063 pmt_t *result = 0) = 0; 00064 00065 // QA only... 00066 mb_mblock_sptr top() { return d_top; } 00067 }; 00068 00069 #endif /* INCLUDED_MB_RUNTIME_H */