summaryrefslogtreecommitdiff
path: root/mblock/src/lib/mb_common.h
blob: 1f78d5a40c0fab619ee197d71fc2b6963f565c6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* -*- c++ -*- */
/*
 * Copyright 2006,2007 Free Software Foundation, Inc.
 * 
 * This file is part of GNU Radio
 * 
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#ifndef INCLUDED_MB_COMMON_H
#define INCLUDED_MB_COMMON_H

#include <pmt.h>
#include <vector>
#include <stdexcept>
#include <boost/utility.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/weak_ptr.hpp>

/*
 * The priority type and valid range
 */
typedef unsigned int	mb_pri_t;
static const mb_pri_t	MB_PRI_BEST    = 0;
static const mb_pri_t	MB_PRI_DEFAULT = 4; 
static const mb_pri_t   MB_PRI_WORST   = 7;
static const mb_pri_t	MB_NPRI = MB_PRI_WORST + 1;	  // number of valid priorities 

/*!
 * \brief return true iff priority a is better than priority b
 */
inline static bool
mb_pri_better(mb_pri_t a, mb_pri_t b)
{
  return a < b;
}

/*!
 * \brief return true iff priority a is worse than priority b
 */
inline static bool
mb_pri_worse(mb_pri_t a, mb_pri_t b)
{
  return a > b;
}

/*!
 * \brief ensure that pri is valid
 */
inline static mb_pri_t
mb_pri_clamp(mb_pri_t p)
{
  return p < MB_NPRI ? p : MB_NPRI - 1;
}

class mb_runtime;
typedef boost::shared_ptr<mb_runtime> mb_runtime_sptr;

//class mb_runtime_impl;
//typedef boost::shared_ptr<mb_runtime_impl> mb_runtime_impl_sptr;

class mb_mblock;
typedef boost::shared_ptr<mb_mblock> mb_mblock_sptr;

class mb_mblock_impl;
typedef boost::shared_ptr<mb_mblock_impl> mb_mblock_impl_sptr;

class mb_port;
typedef boost::shared_ptr<mb_port> mb_port_sptr;

//class mb_port_detail;
//typedef boost::shared_ptr<mb_port_detail> mb_port_detail_sptr;

class mb_msg_accepter;
typedef boost::shared_ptr<mb_msg_accepter> mb_msg_accepter_sptr;

class mb_message;
typedef boost::shared_ptr<mb_message> mb_message_sptr;

class mb_msg_queue;
typedef boost::shared_ptr<mb_msg_queue> mb_msg_queue_sptr;

#endif /* INCLUDED_MB_COMMON_H */