GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2009,2013 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_PMT_SUGAR_H 00023 #define INCLUDED_PMT_SUGAR_H 00024 00025 /*! 00026 * This file is included by pmt.h and contains pseudo-constructor 00027 * shorthand for making pmt objects 00028 */ 00029 00030 #include <gnuradio/messages/msg_accepter.h> 00031 00032 namespace pmt { 00033 00034 //! Make pmt symbol 00035 static inline pmt_t 00036 mp(const std::string &s) 00037 { 00038 return string_to_symbol(s); 00039 } 00040 00041 //! Make pmt symbol 00042 static inline pmt_t 00043 mp(const char *s) 00044 { 00045 return string_to_symbol(s); 00046 } 00047 00048 //! Make pmt long 00049 static inline pmt_t 00050 mp(long x){ 00051 return from_long(x); 00052 } 00053 00054 //! Make pmt long 00055 static inline pmt_t 00056 mp(long long unsigned x){ 00057 return from_long(x); 00058 } 00059 00060 //! Make pmt long 00061 static inline pmt_t 00062 mp(int x){ 00063 return from_long(x); 00064 } 00065 00066 //! Make pmt double 00067 static inline pmt_t 00068 mp(double x){ 00069 return from_double(x); 00070 } 00071 00072 //! Make pmt complex 00073 static inline pmt_t 00074 mp(std::complex<double> z) 00075 { 00076 return make_rectangular(z.real(), z.imag()); 00077 } 00078 00079 //! Make pmt complex 00080 static inline pmt_t 00081 mp(std::complex<float> z) 00082 { 00083 return make_rectangular(z.real(), z.imag()); 00084 } 00085 00086 //! Make pmt msg_accepter 00087 static inline pmt_t 00088 mp(boost::shared_ptr<gr::messages::msg_accepter> ma) 00089 { 00090 return make_msg_accepter(ma); 00091 } 00092 00093 //! Make pmt Binary Large Object (BLOB) 00094 static inline pmt_t 00095 mp(const void *data, size_t len_in_bytes) 00096 { 00097 return make_blob(data, len_in_bytes); 00098 } 00099 00100 //! Make tuple 00101 static inline pmt_t 00102 mp(const pmt_t &e0) 00103 { 00104 return make_tuple(e0); 00105 } 00106 00107 //! Make tuple 00108 static inline pmt_t 00109 mp(const pmt_t &e0, const pmt_t &e1) 00110 { 00111 return make_tuple(e0, e1); 00112 } 00113 00114 //! Make tuple 00115 static inline pmt_t 00116 mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2) 00117 { 00118 return make_tuple(e0, e1, e2); 00119 } 00120 00121 //! Make tuple 00122 static inline pmt_t 00123 mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3) 00124 { 00125 return make_tuple(e0, e1, e2, e3); 00126 } 00127 00128 //! Make tuple 00129 static inline pmt_t 00130 mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4) 00131 { 00132 return make_tuple(e0, e1, e2, e3, e4); 00133 } 00134 00135 //! Make tuple 00136 static inline pmt_t 00137 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) 00138 { 00139 return make_tuple(e0, e1, e2, e3, e4, e5); 00140 } 00141 00142 //! Make tuple 00143 static inline pmt_t 00144 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) 00145 { 00146 return make_tuple(e0, e1, e2, e3, e4, e5, e6); 00147 } 00148 00149 //! Make tuple 00150 static inline pmt_t 00151 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) 00152 { 00153 return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7); 00154 } 00155 00156 //! Make tuple 00157 static inline pmt_t 00158 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) 00159 { 00160 return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8); 00161 } 00162 00163 //! Make tuple 00164 static inline pmt_t 00165 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) 00166 { 00167 return make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9); 00168 } 00169 00170 00171 } /* namespace pmt */ 00172 00173 00174 #endif /* INCLUDED_PMT_SUGAR_H */