GNU Radio Manual and C++ API Reference  3.8.1.0
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 "thrift/gnuradio_types.h"
26 #include <pmt/pmt.h>
27 #include <boost/noncopyable.hpp>
28 #include <boost/ptr_container/ptr_map.hpp>
29 
30 
31 namespace rpcpmtconverter {
32 GNURadio::Knob from_pmt(const pmt::pmt_t& knob);
33 
34 struct to_pmt_f {
35  to_pmt_f() { ; }
36  virtual ~to_pmt_f() {}
37  virtual pmt::pmt_t operator()(const GNURadio::Knob& knob);
38 };
39 
40 struct to_pmt_byte_f : public to_pmt_f {
41  pmt::pmt_t operator()(const GNURadio::Knob& knob);
42 };
43 struct to_pmt_short_f : public to_pmt_f {
44  pmt::pmt_t operator()(const GNURadio::Knob& knob);
45 };
46 struct to_pmt_int_f : public to_pmt_f {
47  pmt::pmt_t operator()(const GNURadio::Knob& knob);
48 };
49 struct to_pmt_long_f : public to_pmt_f {
50  pmt::pmt_t operator()(const GNURadio::Knob& knob);
51 };
52 struct to_pmt_double_f : public to_pmt_f {
53  pmt::pmt_t operator()(const GNURadio::Knob& knob);
54 };
55 struct to_pmt_string_f : public to_pmt_f {
56  pmt::pmt_t operator()(const GNURadio::Knob& knob);
57 };
58 struct to_pmt_bool_f : public to_pmt_f {
59  pmt::pmt_t operator()(const GNURadio::Knob& knob);
60 };
61 struct to_pmt_complex_f : public to_pmt_f {
62  pmt::pmt_t operator()(const GNURadio::Knob& knob);
63 };
64 struct to_pmt_f32vect_f : public to_pmt_f {
65  pmt::pmt_t operator()(const GNURadio::Knob& knob);
66 };
67 struct to_pmt_f64vect_f : public to_pmt_f {
68  pmt::pmt_t operator()(const GNURadio::Knob& knob);
69 };
70 struct to_pmt_s64vect_f : public to_pmt_f {
71  pmt::pmt_t operator()(const GNURadio::Knob& knob);
72 };
73 struct to_pmt_s32vect_f : public to_pmt_f {
74  pmt::pmt_t operator()(const GNURadio::Knob& knob);
75 };
76 struct to_pmt_s16vect_f : public to_pmt_f {
77  pmt::pmt_t operator()(const GNURadio::Knob& knob);
78 };
79 struct to_pmt_s8vect_f : public to_pmt_f {
80  pmt::pmt_t operator()(const GNURadio::Knob& knob);
81 };
82 struct to_pmt_c32vect_f : public to_pmt_f {
83  pmt::pmt_t operator()(const GNURadio::Knob& knob);
84 };
85 
86 class To_PMT : private boost::noncopyable
87 {
88 public:
89  static To_PMT instance;
90  template <typename TO_PMT_F>
91  friend struct to_pmt_reg;
92  pmt::pmt_t operator()(const GNURadio::Knob& knob);
93 
94 protected:
95  boost::ptr_map<GNURadio::BaseTypes::type, to_pmt_f> to_pmt_map;
96 
97 private:
98  To_PMT() { ; }
99 };
100 
101 template <typename TO_PMT_F>
102 struct to_pmt_reg {
103  to_pmt_reg(To_PMT& instance, const GNURadio::BaseTypes::type type);
104 };
105 } // namespace rpcpmtconverter
106 
107 #endif /* RPCPMTCONVERTERS_THRIFT_H */
Definition: rpcpmtconverters_thrift.h:31
Definition: rpcpmtconverters_thrift.h:64
Definition: rpcpmtconverters_thrift.h:52
boost::shared_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:96
Definition: rpcpmtconverters_thrift.h:70
Definition: rpcpmtconverters_thrift.h:102
Definition: rpcpmtconverters_thrift.h:73
Definition: rpcpmtconverters_thrift.h:40
virtual ~to_pmt_f()
Definition: rpcpmtconverters_thrift.h:36
Definition: rpcpmtconverters_thrift.h:76
Definition: rpcpmtconverters_thrift.h:34
Definition: rpcpmtconverters_thrift.h:43
Definition: rpcpmtconverters_thrift.h:58
Definition: rpcpmtconverters_thrift.h:49
static To_PMT instance
Definition: rpcpmtconverters_thrift.h:89
boost::ptr_map< GNURadio::BaseTypes::type, to_pmt_f > to_pmt_map
Definition: rpcpmtconverters_thrift.h:95
Definition: rpcpmtconverters_thrift.h:55
Definition: rpcpmtconverters_thrift.h:79
to_pmt_f()
Definition: rpcpmtconverters_thrift.h:35
virtual pmt::pmt_t operator()(const GNURadio::Knob &knob)
Definition: rpcpmtconverters_thrift.h:82
Definition: rpcpmtconverters_thrift.h:86
Definition: rpcpmtconverters_thrift.h:67
GNURadio::Knob from_pmt(const pmt::pmt_t &knob)
Definition: rpcpmtconverters_thrift.h:46
Definition: rpcpmtconverters_thrift.h:61