commit-gnuradio
[Top][All Lists]
Advanced

[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();
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]