GNU Radio 3.5.3.2 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(int x){
00054     return pmt_from_long(x);
00055   }
00056 
00057   //! Make pmt double
00058   static inline pmt_t
00059   mp(double x){
00060     return pmt_from_double(x);
00061   }
00062   
00063   //! Make pmt complex
00064   static inline pmt_t
00065   mp(std::complex<double> z)
00066   {
00067     return pmt_make_rectangular(z.real(), z.imag());
00068   }
00069 
00070   //! Make pmt complex
00071   static inline pmt_t
00072   mp(std::complex<float> z)
00073   {
00074     return pmt_make_rectangular(z.real(), z.imag());
00075   }
00076 
00077   //! Make pmt msg_accepter
00078   static inline pmt_t
00079   mp(boost::shared_ptr<gruel::msg_accepter> ma)
00080   {
00081     return pmt_make_msg_accepter(ma);
00082   }
00083 
00084   //! Make pmt Binary Large Object (BLOB)
00085   static inline pmt_t
00086   mp(const void *data, size_t len_in_bytes)
00087   {
00088     return pmt_make_blob(data, len_in_bytes);
00089   }
00090 
00091   //! Make tuple
00092   static inline pmt_t
00093   mp(const pmt_t &e0)
00094   {
00095     return pmt_make_tuple(e0);
00096   }
00097 
00098   //! Make tuple
00099   static inline pmt_t
00100   mp(const pmt_t &e0, const pmt_t &e1)
00101   {
00102     return pmt_make_tuple(e0, e1);
00103   }
00104 
00105   //! Make tuple
00106   static inline pmt_t
00107   mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
00108   {
00109     return pmt_make_tuple(e0, e1, e2);
00110   }
00111 
00112   //! Make tuple
00113   static inline pmt_t
00114   mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
00115   {
00116     return pmt_make_tuple(e0, e1, e2, e3);
00117   }
00118 
00119   //! Make tuple
00120   static inline pmt_t
00121   mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
00122   {
00123     return pmt_make_tuple(e0, e1, e2, e3, e4);
00124   }
00125 
00126   //! Make tuple
00127   static inline pmt_t
00128   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)
00129   {
00130     return pmt_make_tuple(e0, e1, e2, e3, e4, e5);
00131   }
00132 
00133   //! Make tuple
00134   static inline pmt_t
00135   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)
00136   {
00137     return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6);
00138   }
00139 
00140   //! Make tuple
00141   static inline pmt_t
00142   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)
00143   {
00144     return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7);
00145   }
00146 
00147   //! Make tuple
00148   static inline pmt_t
00149   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)
00150   {
00151     return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8);
00152   }
00153 
00154   //! Make tuple
00155   static inline pmt_t
00156   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)
00157   {
00158     return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9);
00159   }
00160 
00161 
00162 } /* namespace pmt */
00163 
00164 
00165 #endif /* INCLUDED_GRUEL_PMT_SUGAR_H */