GNU Radio Manual and C++ API Reference  3.7.13.4
The Free & Open Software Radio Ecosystem
rpcpmtconverters_thrift.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014,2015 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef RPCPMTCONVERTERS_THRIFT_H
23 #define RPCPMTCONVERTERS_THRIFT_H
24 
25 #include <pmt/pmt.h>
26 #include <boost/noncopyable.hpp>
27 #include <boost/ptr_container/ptr_map.hpp>
28 #include "thrift/gnuradio_types.h"
29 
30 
31 namespace rpcpmtconverter
32 {
33  GNURadio::Knob from_pmt(const pmt::pmt_t& knob);
34 
35  struct to_pmt_f {
36  to_pmt_f() {;}
37  virtual ~to_pmt_f() {}
38  virtual pmt::pmt_t operator()(const GNURadio::Knob& knob);
39  };
40 
41  struct to_pmt_byte_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
42  struct to_pmt_short_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
43  struct to_pmt_int_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
44  struct to_pmt_long_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
45  struct to_pmt_double_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
46  struct to_pmt_string_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
47  struct to_pmt_bool_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
48  struct to_pmt_complex_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
49  struct to_pmt_f32vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
50  struct to_pmt_f64vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
51  struct to_pmt_s64vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
52  struct to_pmt_s32vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
53  struct to_pmt_s16vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
54  struct to_pmt_s8vect_f : public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
55  struct to_pmt_c32vect_f: public to_pmt_f { pmt::pmt_t operator()(const GNURadio::Knob& knob); };
56 
57  class To_PMT : private boost::noncopyable {
58  public:
59  static To_PMT instance;
60  template<typename TO_PMT_F> friend struct to_pmt_reg;
61  pmt::pmt_t operator()(const GNURadio::Knob& knob);
62 
63  protected:
64  boost::ptr_map<GNURadio::BaseTypes::type, to_pmt_f> to_pmt_map;
65 
66  private:
67  To_PMT() {;}
68  };
69 
70  template<typename TO_PMT_F> struct to_pmt_reg {
71  to_pmt_reg(To_PMT& instance, const GNURadio::BaseTypes::type type);
72  };
73 }
74 
75 #endif /* RPCPMTCONVERTERS_THRIFT_H */
Definition: rpcpmtconverters_thrift.h:31
Definition: rpcpmtconverters_thrift.h:49
Definition: rpcpmtconverters_thrift.h:45
Definition: rpcpmtconverters_thrift.h:51
Definition: rpcpmtconverters_thrift.h:70
Definition: rpcpmtconverters_thrift.h:52
Definition: rpcpmtconverters_thrift.h:41
virtual ~to_pmt_f()
Definition: rpcpmtconverters_thrift.h:37
Definition: rpcpmtconverters_thrift.h:53
Definition: rpcpmtconverters_thrift.h:35
Definition: rpcpmtconverters_thrift.h:42
Definition: rpcpmtconverters_thrift.h:47
Definition: rpcpmtconverters_thrift.h:44
static To_PMT instance
Definition: rpcpmtconverters_thrift.h:59
boost::ptr_map< GNURadio::BaseTypes::type, to_pmt_f > to_pmt_map
Definition: rpcpmtconverters_thrift.h:64
Definition: rpcpmtconverters_thrift.h:46
Definition: rpcpmtconverters_thrift.h:54
to_pmt_f()
Definition: rpcpmtconverters_thrift.h:36
virtual pmt::pmt_t operator()(const GNURadio::Knob &knob)
Definition: rpcpmtconverters_thrift.h:55
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:56
Definition: rpcpmtconverters_thrift.h:57
Definition: rpcpmtconverters_thrift.h:50
GNURadio::Knob from_pmt(const pmt::pmt_t &knob)
Definition: rpcpmtconverters_thrift.h:43
Definition: rpcpmtconverters_thrift.h:48