GNU Radio 3.6.3 C++ API
pmt_sugar.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
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)
10  * any later version.
11  *
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.
16  *
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.
20  */
21 #ifndef INCLUDED_GRUEL_PMT_SUGAR_H
22 #define INCLUDED_GRUEL_PMT_SUGAR_H
23 
24 /*!
25  * This file is included by pmt.h and contains pseudo-constructor
26  * shorthand for making pmt objects
27  */
28 
29 namespace pmt {
30 
31  //! Make pmt symbol
32  static inline pmt_t
33  mp(const std::string &s)
34  {
35  return pmt_string_to_symbol(s);
36  }
37 
38  //! Make pmt symbol
39  static inline pmt_t
40  mp(const char *s)
41  {
42  return pmt_string_to_symbol(s);
43  }
44 
45  //! Make pmt long
46  static inline pmt_t
47  mp(long x){
48  return pmt_from_long(x);
49  }
50 
51  //! Make pmt long
52  static inline pmt_t
53  mp(long long unsigned x){
54  return pmt_from_long(x);
55  }
56 
57  //! Make pmt long
58  static inline pmt_t
59  mp(int x){
60  return pmt_from_long(x);
61  }
62 
63  //! Make pmt double
64  static inline pmt_t
65  mp(double x){
66  return pmt_from_double(x);
67  }
68 
69  //! Make pmt complex
70  static inline pmt_t
71  mp(std::complex<double> z)
72  {
73  return pmt_make_rectangular(z.real(), z.imag());
74  }
75 
76  //! Make pmt complex
77  static inline pmt_t
78  mp(std::complex<float> z)
79  {
80  return pmt_make_rectangular(z.real(), z.imag());
81  }
82 
83  //! Make pmt msg_accepter
84  static inline pmt_t
86  {
87  return pmt_make_msg_accepter(ma);
88  }
89 
90  //! Make pmt Binary Large Object (BLOB)
91  static inline pmt_t
92  mp(const void *data, size_t len_in_bytes)
93  {
94  return pmt_make_blob(data, len_in_bytes);
95  }
96 
97  //! Make tuple
98  static inline pmt_t
99  mp(const pmt_t &e0)
100  {
101  return pmt_make_tuple(e0);
102  }
103 
104  //! Make tuple
105  static inline pmt_t
106  mp(const pmt_t &e0, const pmt_t &e1)
107  {
108  return pmt_make_tuple(e0, e1);
109  }
110 
111  //! Make tuple
112  static inline pmt_t
113  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
114  {
115  return pmt_make_tuple(e0, e1, e2);
116  }
117 
118  //! Make tuple
119  static inline pmt_t
120  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
121  {
122  return pmt_make_tuple(e0, e1, e2, e3);
123  }
124 
125  //! Make tuple
126  static inline pmt_t
127  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
128  {
129  return pmt_make_tuple(e0, e1, e2, e3, e4);
130  }
131 
132  //! Make tuple
133  static inline pmt_t
134  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5)
135  {
136  return pmt_make_tuple(e0, e1, e2, e3, e4, e5);
137  }
138 
139  //! Make tuple
140  static inline pmt_t
141  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6)
142  {
143  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6);
144  }
145 
146  //! Make tuple
147  static inline pmt_t
148  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7)
149  {
150  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7);
151  }
152 
153  //! Make tuple
154  static inline pmt_t
155  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8)
156  {
157  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8);
158  }
159 
160  //! Make tuple
161  static inline pmt_t
162  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
163  {
164  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9);
165  }
166 
167 
168 } /* namespace pmt */
169 
170 
171 #endif /* INCLUDED_GRUEL_PMT_SUGAR_H */