summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2015-03-02 09:57:42 -0500
committerTom Rondeau <tom@trondeau.com>2015-04-02 15:38:57 -0700
commitc67d0a417f43c644a0ccabe46b38a1e48c3bd15d (patch)
tree2854441370cb1f9e158a61e250719039785b6b01 /gnuradio-runtime/lib
parent7a8989d21de2f9a121eafe56ce0b557572a498d4 (diff)
controlport: simple style editing.
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift2
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc114
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc41
3 files changed, 104 insertions, 53 deletions
diff --git a/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift b/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
index 66fbd639e3..ae7f839a2f 100644
--- a/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
+++ b/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
index d79b488b58..79620322a5 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
@@ -141,74 +141,104 @@ rpcpmtconverter::from_pmt(const pmt::pmt_t& knob)
return GNURadio::Knob();
}
-pmt::pmt_t rpcpmtconverter::to_pmt_byte_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_byte_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::mp(knob.value.a_byte);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_short_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_short_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::mp(knob.value.a_short);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_int_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_int_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::mp(knob.value.a_int);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_long_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_long_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::mp(knob.value.a_long);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_double_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_double_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::mp(knob.value.a_double);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_string_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_string_f::operator()(const GNURadio::Knob& knob)
+{
return pmt::string_to_symbol(knob.value.a_string);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_bool_f::operator()(const GNURadio::Knob& knob) {
- if (knob.value.a_bool)
+pmt::pmt_t
+rpcpmtconverter::to_pmt_bool_f::operator()(const GNURadio::Knob& knob)
+{
+ if(knob.value.a_bool)
return pmt::PMT_T;
else
return pmt::PMT_F;
}
-pmt::pmt_t rpcpmtconverter::to_pmt_complex_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_complex_f::operator()(const GNURadio::Knob& knob)
+{
gr_complexd cpx(knob.value.a_complex.re, knob.value.a_complex.im);
return pmt::from_complex(cpx);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_f32vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_f32vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<double> v_double = knob.value.a_f32vector;
std::vector<float> v(v_double.begin(), v_double.end());
return pmt::init_f32vector(v.size(), v);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_f64vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_f64vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<double> v = knob.value.a_f64vector;
return pmt::init_f64vector(v.size(), v);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_s64vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_s64vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<int64_t> v = knob.value.a_s64vector;
return pmt::init_s64vector(v.size(), v);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_s32vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_s32vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<int32_t> v = knob.value.a_s32vector;
return pmt::init_s32vector(v.size(), v);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_s16vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_s16vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<int16_t> v = knob.value.a_s16vector;
return pmt::init_s16vector(v.size(), v);
}
-pmt::pmt_t rpcpmtconverter::to_pmt_s8vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_s8vect_f::operator()(const GNURadio::Knob& knob)
+{
std::basic_string<char> v = knob.value.a_s8vector;
return pmt::init_s8vector(v.size(), reinterpret_cast<const int8_t*>(v.data()));
}
-pmt::pmt_t rpcpmtconverter::to_pmt_c32vect_f::operator()(const GNURadio::Knob& knob) {
+pmt::pmt_t
+rpcpmtconverter::to_pmt_c32vect_f::operator()(const GNURadio::Knob& knob)
+{
std::vector<GNURadio::complex> v0 = knob.value.a_c32vector;
std::vector<GNURadio::complex>::iterator vitr;
std::vector<gr_complex> v;
@@ -220,26 +250,42 @@ pmt::pmt_t rpcpmtconverter::to_pmt_c32vect_f::operator()(const GNURadio::Knob& k
rpcpmtconverter::To_PMT rpcpmtconverter::To_PMT::instance;
-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);
+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)
+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_F>(instance.to_pmt_map)(type);
+ boost::assign::ptr_map_insert<TO_PMT_F>(instance.to_pmt_map)(type);
}
pmt::pmt_t
@@ -253,5 +299,5 @@ rpcpmtconverter::to_pmt_f::operator()(const GNURadio::Knob& knob)
pmt::pmt_t
rpcpmtconverter::To_PMT::operator()(const GNURadio::Knob& knob)
{
- return to_pmt_map[knob.type](knob);
+ return to_pmt_map[knob.type](knob);
}
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
index 5dbfb8d088..bc878a8e1a 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -46,14 +46,15 @@ rpcserver_thrift::~rpcserver_thrift()
}
void
-rpcserver_thrift::registerConfigureCallback(const std::string &id, const configureCallback_t callback)
+rpcserver_thrift::registerConfigureCallback(const std::string &id,
+ const configureCallback_t callback)
{
{
ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id));
if(iter != d_setcallbackmap.end()) {
std::stringstream s;
s << "rpcserver_thrift:: rpcserver_thrift ERROR registering set, already registered: "
- << id << std::endl;
+ << id << std::endl;
throw std::runtime_error(s.str().c_str());
}
}
@@ -71,7 +72,7 @@ rpcserver_thrift::unregisterConfigureCallback(const std::string &id)
if(iter == d_setcallbackmap.end()) {
std::stringstream s;
s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering set, not registered: "
- << id << std::endl;
+ << id << std::endl;
throw std::runtime_error(s.str().c_str());
}
@@ -90,7 +91,7 @@ rpcserver_thrift::registerQueryCallback(const std::string &id,
if(iter != d_getcallbackmap.end()) {
std::stringstream s;
s << "rpcserver_thrift:: rpcserver_thrift ERROR registering get, already registered: "
- << id << std::endl;
+ << id << std::endl;
throw std::runtime_error(s.str().c_str());
}
}
@@ -108,7 +109,7 @@ rpcserver_thrift::unregisterQueryCallback(const std::string &id)
if(iter == d_getcallbackmap.end()) {
std::stringstream s;
s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering get, registered: "
- << id << std::endl;
+ << id << std::endl;
throw std::runtime_error(s.str().c_str());
}
@@ -129,19 +130,20 @@ rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs)
void
-rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return, const GNURadio::KnobIDList& knobs)
+rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return,
+ const GNURadio::KnobIDList& knobs)
{
GNURadio::KnobMap outknobs;
if(knobs.size() == 0) {
std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(),
- get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap>
- (d_getcallbackmap, cur_priv, outknobs));
+ get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap>
+ (d_getcallbackmap, cur_priv, outknobs));
}
else {
std::for_each(knobs.begin(), knobs.end(),
- get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
- (d_getcallbackmap, cur_priv, outknobs));
+ get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
+ (d_getcallbackmap, cur_priv, outknobs));
}
_return = outknobs;
}
@@ -159,9 +161,9 @@ rpcserver_thrift::getRe(GNURadio::KnobMap& _return, const GNURadio::KnobIDList&
else {
QueryCallbackMap_t::iterator it;
for(it = d_getcallbackmap.begin(); it != d_getcallbackmap.end(); it++){
- for(size_t j=0; j<knobs.size(); j++){
+ for(size_t j=0; j<knobs.size(); j++) {
const boost::xpressive::sregex re(boost::xpressive::sregex::compile(knobs[j]));
- if(boost::xpressive::regex_match(it->first, re)){
+ if(boost::xpressive::regex_match(it->first, re)) {
get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
(d_getcallbackmap, cur_priv, outknobs)(it->first);
break;
@@ -173,19 +175,22 @@ rpcserver_thrift::getRe(GNURadio::KnobMap& _return, const GNURadio::KnobIDList&
}
void
-rpcserver_thrift::properties(GNURadio::KnobPropMap& _return, const GNURadio::KnobIDList& knobs)
+rpcserver_thrift::properties(GNURadio::KnobPropMap& _return,
+ const GNURadio::KnobIDList& knobs)
{
GNURadio::KnobPropMap outknobs;
if(knobs.size() == 0) {
std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(),
- properties_all_f<QueryCallbackMap_t::value_type,
- QueryCallbackMap_t, GNURadio::KnobPropMap>(d_getcallbackmap, cur_priv, outknobs));
+ properties_all_f<QueryCallbackMap_t::value_type,
+ QueryCallbackMap_t, GNURadio::KnobPropMap>(d_getcallbackmap,
+ cur_priv, outknobs));
}
else {
std::for_each(knobs.begin(), knobs.end(),
- properties_f<GNURadio::KnobIDList::value_type,
- QueryCallbackMap_t, GNURadio::KnobPropMap>(d_getcallbackmap, cur_priv, outknobs));
+ properties_f<GNURadio::KnobIDList::value_type,
+ QueryCallbackMap_t, GNURadio::KnobPropMap>(d_getcallbackmap,
+ cur_priv, outknobs));
}
_return = outknobs;
}