GNU Radio 3.6.5 C++ API

pmt_sugar.h

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