[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT regis
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT registration objects |
Date: |
Wed, 15 Apr 2015 21:07:53 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 4b0b45a60de40f0d0b734b73adaf829cf7e63e8a
Author: Nate Goergen <address@hidden>
Date: Sun Mar 1 19:17:44 2015 -0600
controlport: convert to To_PMT registration objects
---
.../include/gnuradio/rpcpmtconverters_thrift.h | 19 ++++++-----
.../controlport/thrift/rpcpmtconverters_thrift.cc | 38 ++++++++++++----------
2 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
index 5a0402c..4c074f0 100644
--- a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
@@ -33,9 +33,8 @@ namespace rpcpmtconverter
GNURadio::Knob from_pmt(const pmt::pmt_t& knob);
struct to_pmt_f {
- to_pmt_f() {;}
-
- virtual pmt::pmt_t operator()(const GNURadio::Knob& knob);
+ to_pmt_f() {;}
+ virtual pmt::pmt_t operator()(const GNURadio::Knob& knob);
};
struct to_pmt_byte_f : public to_pmt_f { pmt::pmt_t operator()(const
GNURadio::Knob& knob); };
@@ -55,16 +54,20 @@ namespace rpcpmtconverter
struct to_pmt_c32vect_f: public to_pmt_f { pmt::pmt_t operator()(const
GNURadio::Knob& knob); };
class To_PMT : private boost::noncopyable {
-
public:
static To_PMT instance;
-
+ template<typename TO_PMT_F> friend struct to_pmt_reg;
pmt::pmt_t operator()(const GNURadio::Knob& knob);
- private:
- To_PMT();
-
+ protected:
boost::ptr_map<GNURadio::BaseTypes::type, to_pmt_f> to_pmt_map;
+
+ private:
+ To_PMT() {;}
+ };
+
+ template<typename TO_PMT_F> struct to_pmt_reg {
+ to_pmt_reg(To_PMT& instance, const GNURadio::BaseTypes::type type);
};
}
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
index a16f2ad..d79b488 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
@@ -220,29 +220,33 @@ pmt::pmt_t
rpcpmtconverter::to_pmt_c32vect_f::operator()(const GNURadio::Knob& k
rpcpmtconverter::To_PMT rpcpmtconverter::To_PMT::instance;
-rpcpmtconverter::To_PMT::To_PMT()
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_bool_f>
reg_bool(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::BOOL);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_byte_f>
reg_byte(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::BYTE);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_short_f>
reg_short(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::SHORT);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_int_f>
reg_int(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::INT);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_long_f>
reg_long(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::LONG);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_double_f>
reg_double(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::DOUBLE);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_string_f>
reg_string(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::STRING);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_complex_f>
reg_complex(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::COMPLEX);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_f32vect_f>
reg_f32v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::F32VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_f64vect_f>
reg_f64v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::F64VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_s64vect_f>
reg_s64v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::S64VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_s32vect_f>
reg_s32v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::S32VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_s16vect_f>
reg_s16v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::S16VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_s8vect_f>
reg_s8v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::S8VECTOR);
+rpcpmtconverter::to_pmt_reg<rpcpmtconverter::to_pmt_c32vect_f>
reg_c32v(rpcpmtconverter::To_PMT::instance, GNURadio::BaseTypes::C32VECTOR);
+
+template<typename TO_PMT_F>
+rpcpmtconverter::to_pmt_reg<TO_PMT_F>::to_pmt_reg(To_PMT& instance, const
GNURadio::BaseTypes::type type)
{
-
boost::assign::ptr_map_insert<to_pmt_bool_f>(to_pmt_map)(GNURadio::BaseTypes::BOOL);
-
boost::assign::ptr_map_insert<to_pmt_byte_f>(to_pmt_map)(GNURadio::BaseTypes::BYTE);
-
boost::assign::ptr_map_insert<to_pmt_short_f>(to_pmt_map)(GNURadio::BaseTypes::SHORT);
-
boost::assign::ptr_map_insert<to_pmt_int_f>(to_pmt_map)(GNURadio::BaseTypes::INT);
-
boost::assign::ptr_map_insert<to_pmt_long_f>(to_pmt_map)(GNURadio::BaseTypes::LONG);
-
boost::assign::ptr_map_insert<to_pmt_double_f>(to_pmt_map)(GNURadio::BaseTypes::DOUBLE);
-
boost::assign::ptr_map_insert<to_pmt_string_f>(to_pmt_map)(GNURadio::BaseTypes::STRING);
-
boost::assign::ptr_map_insert<to_pmt_complex_f>(to_pmt_map)(GNURadio::BaseTypes::COMPLEX);
-
boost::assign::ptr_map_insert<to_pmt_f32vect_f>(to_pmt_map)(GNURadio::BaseTypes::F32VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_f64vect_f>(to_pmt_map)(GNURadio::BaseTypes::F64VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_s64vect_f>(to_pmt_map)(GNURadio::BaseTypes::S64VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_s32vect_f>(to_pmt_map)(GNURadio::BaseTypes::S32VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_s16vect_f>(to_pmt_map)(GNURadio::BaseTypes::S16VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_s8vect_f>(to_pmt_map)(GNURadio::BaseTypes::S8VECTOR);
-
boost::assign::ptr_map_insert<to_pmt_c32vect_f>(to_pmt_map)(GNURadio::BaseTypes::C32VECTOR);
+ boost::assign::ptr_map_insert<TO_PMT_F>(instance.to_pmt_map)(type);
}
pmt::pmt_t
rpcpmtconverter::to_pmt_f::operator()(const GNURadio::Knob& knob)
{
- std::cerr << "Error: Don't know how to handle Knob Type: " << knob.type <<
std::endl; assert(0);
+ std::cerr << "Error: Don't know how to handle Knob Type: " << knob.type <<
std::endl;
+ assert(0);
return pmt::pmt_t();
}
- [Commit-gnuradio] [gnuradio] branch master updated (676d5cb -> b092142), git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 03/50: controlport: working controlport server using thrift., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 06/50: controlport: quick fix, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 02/50: ctrlport: thrift: "py" instead of "python" -- guessing a version thing, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 04/50: controlport: restructuring to add subdirs for different cp backends., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 18/50: controlport: improving transport layer throughput., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 07/50: controlport: Addes a FindThrift cmake module to find the Thrift headers, libraries, and Python files., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT registration objects,
git <=
- [Commit-gnuradio] [gnuradio] 20/50: runtime: more generic version of prefs class., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 22/50: cmake: force QA tests to turn ControlPort off by default., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 15/50: controlport: convert rpcpmtconverter::to_pmt() if statement to a function object map, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 01/50: Initial thrift definition for gnuradio, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 14/50: controlport: Thrift's binary type, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 09/50: controlport: cleanup and switching over to new Python common interface., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 23/50: controlport: cleaning up and using logger to display endpoint., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 34/50: controlport: replacement of nanosleep() with boost::sleep() in startup thread. Fix of merge error in booter_thrift., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 28/50: controlport: more cleaning up., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 31/50: controlport: moving the logger call that publishes Thrift's endpoint to i_impl()., git, 2015/04/16