GNU Radio 3.6.1 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(int x){
54  return pmt_from_long(x);
55  }
56 
57  //! Make pmt double
58  static inline pmt_t
59  mp(double x){
60  return pmt_from_double(x);
61  }
62 
63  //! Make pmt complex
64  static inline pmt_t
65  mp(std::complex<double> z)
66  {
67  return pmt_make_rectangular(z.real(), z.imag());
68  }
69 
70  //! Make pmt complex
71  static inline pmt_t
72  mp(std::complex<float> z)
73  {
74  return pmt_make_rectangular(z.real(), z.imag());
75  }
76 
77  //! Make pmt msg_accepter
78  static inline pmt_t
80  {
81  return pmt_make_msg_accepter(ma);
82  }
83 
84  //! Make pmt Binary Large Object (BLOB)
85  static inline pmt_t
86  mp(const void *data, size_t len_in_bytes)
87  {
88  return pmt_make_blob(data, len_in_bytes);
89  }
90 
91  //! Make tuple
92  static inline pmt_t
93  mp(const pmt_t &e0)
94  {
95  return pmt_make_tuple(e0);
96  }
97 
98  //! Make tuple
99  static inline pmt_t
100  mp(const pmt_t &e0, const pmt_t &e1)
101  {
102  return pmt_make_tuple(e0, e1);
103  }
104 
105  //! Make tuple
106  static inline pmt_t
107  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
108  {
109  return pmt_make_tuple(e0, e1, e2);
110  }
111 
112  //! Make tuple
113  static inline pmt_t
114  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
115  {
116  return pmt_make_tuple(e0, e1, e2, e3);
117  }
118 
119  //! Make tuple
120  static inline pmt_t
121  mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
122  {
123  return pmt_make_tuple(e0, e1, e2, e3, e4);
124  }
125 
126  //! Make tuple
127  static inline pmt_t
128  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)
129  {
130  return pmt_make_tuple(e0, e1, e2, e3, e4, e5);
131  }
132 
133  //! Make tuple
134  static inline pmt_t
135  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)
136  {
137  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6);
138  }
139 
140  //! Make tuple
141  static inline pmt_t
142  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)
143  {
144  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7);
145  }
146 
147  //! Make tuple
148  static inline pmt_t
149  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)
150  {
151  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8);
152  }
153 
154  //! Make tuple
155  static inline pmt_t
156  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)
157  {
158  return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9);
159  }
160 
161 
162 } /* namespace pmt */
163 
164 
165 #endif /* INCLUDED_GRUEL_PMT_SUGAR_H */