common.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006,2007,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_COMMON_H
00022 #define INCLUDED_MB_COMMON_H
00023 
00024 #include <pmt.h>
00025 #include <vector>
00026 #include <stdexcept>
00027 #include <boost/utility.hpp>
00028 #include <boost/enable_shared_from_this.hpp>
00029 #include <boost/weak_ptr.hpp>
00030 
00031 /*
00032  * The priority type and valid range
00033  */
00034 typedef unsigned int    mb_pri_t;
00035 static const mb_pri_t   MB_PRI_BEST    = 0;
00036 static const mb_pri_t   MB_PRI_DEFAULT = 4; 
00037 static const mb_pri_t   MB_PRI_WORST   = 7;
00038 static const mb_pri_t   MB_NPRI = MB_PRI_WORST + 1;       // number of valid priorities 
00039 
00040 /*!
00041  * \brief return true iff priority a is better than priority b
00042  */
00043 inline static bool
00044 mb_pri_better(mb_pri_t a, mb_pri_t b)
00045 {
00046   return a < b;
00047 }
00048 
00049 /*!
00050  * \brief return true iff priority a is worse than priority b
00051  */
00052 inline static bool
00053 mb_pri_worse(mb_pri_t a, mb_pri_t b)
00054 {
00055   return a > b;
00056 }
00057 
00058 /*!
00059  * \brief ensure that pri is valid
00060  */
00061 inline static mb_pri_t
00062 mb_pri_clamp(mb_pri_t p)
00063 {
00064   return p < MB_NPRI ? p : MB_NPRI - 1;
00065 }
00066 
00067 class mb_runtime;
00068 typedef boost::shared_ptr<mb_runtime> mb_runtime_sptr;
00069 
00070 //class mb_runtime_impl;
00071 //typedef boost::shared_ptr<mb_runtime_impl> mb_runtime_impl_sptr;
00072 
00073 class mb_mblock;
00074 typedef boost::shared_ptr<mb_mblock> mb_mblock_sptr;
00075 
00076 class mb_mblock_impl;
00077 typedef boost::shared_ptr<mb_mblock_impl> mb_mblock_impl_sptr;
00078 
00079 class mb_port;
00080 typedef boost::shared_ptr<mb_port> mb_port_sptr;
00081 
00082 //class mb_port_detail;
00083 //typedef boost::shared_ptr<mb_port_detail> mb_port_detail_sptr;
00084 
00085 class mb_msg_accepter;
00086 typedef boost::shared_ptr<mb_msg_accepter> mb_msg_accepter_sptr;
00087 
00088 class mb_message;
00089 typedef boost::shared_ptr<mb_message> mb_message_sptr;
00090 
00091 class mb_msg_queue;
00092 typedef boost::shared_ptr<mb_msg_queue> mb_msg_queue_sptr;
00093 
00094 #endif /* INCLUDED_MB_COMMON_H */

Generated on Wed Jul 29 07:24:32 2009 for GNU Radio 3.2.2 C++ API by  doxygen 1.5.8