GNU Radio 3.2.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2007 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 00022 #ifndef INCLUDED_MB_RUNTIME_BASE_H 00023 #define INCLUDED_MB_RUNTIME_BASE_H 00024 00025 #include <mblock/runtime.h> 00026 #include <gnuradio/omnithread.h> 00027 #include <mblock/time.h> 00028 00029 /* 00030 * \brief This is the runtime class used by the implementation. 00031 */ 00032 class mb_runtime_base : public mb_runtime 00033 { 00034 omni_mutex d_brl; // big runtime lock (avoid using this if possible...) 00035 00036 protected: 00037 mb_msg_accepter_sptr d_accepter; 00038 00039 public: 00040 00041 /*! 00042 * \brief lock the big runtime lock 00043 * \internal 00044 */ 00045 inline void lock() { d_brl.lock(); } 00046 00047 /*! 00048 * \brief unlock the big runtime lock 00049 * \internal 00050 */ 00051 inline void unlock() { d_brl.unlock(); } 00052 00053 virtual void request_shutdown(pmt_t result); 00054 00055 virtual mb_mblock_sptr 00056 create_component(const std::string &instance_name, 00057 const std::string &class_name, 00058 pmt_t user_arg) = 0; 00059 00060 virtual pmt_t 00061 schedule_one_shot_timeout(const mb_time &abs_time, pmt_t user_data, 00062 mb_msg_accepter_sptr accepter); 00063 00064 virtual pmt_t 00065 schedule_periodic_timeout(const mb_time &first_abs_time, 00066 const mb_time &delta_time, 00067 pmt_t user_data, 00068 mb_msg_accepter_sptr accepter); 00069 virtual void 00070 cancel_timeout(pmt_t handle); 00071 00072 mb_msg_accepter_sptr 00073 accepter() { return d_accepter; } 00074 00075 }; 00076 00077 00078 #endif /* INCLUDED_MB_RUNTIME_BASE_H */