summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/controlport
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2019-08-07 21:45:12 +0200
committerMarcus Müller <marcus@hostalia.de>2019-08-09 23:04:28 +0200
commitf7bbf2c1d8d780294f3e016aff239ca35eb6516e (patch)
treee09ab6112e02b2215b2d59ac24d3d6ea2edac745 /gnuradio-runtime/lib/controlport
parent78431dc6941e3acc67c858277dfe4a0ed583643c (diff)
Tree: clang-format without the include sorting
Diffstat (limited to 'gnuradio-runtime/lib/controlport')
-rw-r--r--gnuradio-runtime/lib/controlport/rpcmanager.cc52
-rw-r--r--gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc108
-rw-r--r--gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc44
-rw-r--r--gnuradio-runtime/lib/controlport/rpcserver_selector.cc6
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc396
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc138
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc366
7 files changed, 535 insertions, 575 deletions
diff --git a/gnuradio-runtime/lib/controlport/rpcmanager.cc b/gnuradio-runtime/lib/controlport/rpcmanager.cc
index fee255498e..aa9fc08cde 100644
--- a/gnuradio-runtime/lib/controlport/rpcmanager.cc
+++ b/gnuradio-runtime/lib/controlport/rpcmanager.cc
@@ -24,40 +24,36 @@
#include <iostream>
#include <stdexcept>
-rpcmanager::rpcmanager() {;}
+rpcmanager::rpcmanager() { ; }
-rpcmanager::~rpcmanager() {;}
+rpcmanager::~rpcmanager() { ; }
-rpcserver_booter_base*
-rpcmanager::get()
+rpcserver_booter_base* rpcmanager::get()
{
- if(aggregator_registered) {
- return aggregator.get();
- }
- else if(booter_registered) {
+ if (aggregator_registered) {
+ return aggregator.get();
+ } else if (booter_registered) {
+ return boot.get();
+ }
+ assert(booter_registered || aggregator_registered);
return boot.get();
- }
- assert(booter_registered || aggregator_registered);
- return boot.get();
}
-void
-rpcmanager::register_booter(rpcserver_booter_base* booter)
+void rpcmanager::register_booter(rpcserver_booter_base* booter)
{
- if(make_aggregator && !aggregator_registered) {
- aggregator.reset(new rpcserver_booter_aggregator());
- aggregator_registered = true;
- }
+ if (make_aggregator && !aggregator_registered) {
+ aggregator.reset(new rpcserver_booter_aggregator());
+ aggregator_registered = true;
+ }
- if(aggregator_registered) {
- rpcmanager::rpcserver_booter_base_sptr bootreg(booter);
- aggregator->agg()->registerServer(bootreg);
- }
- else if(!booter_registered) {
- boot.reset(booter);
- booter_registered = true;
- }
- else {
- throw std::runtime_error("rpcmanager: Aggregator not in use, and a rpc booter is already registered\n");
- }
+ if (aggregator_registered) {
+ rpcmanager::rpcserver_booter_base_sptr bootreg(booter);
+ aggregator->agg()->registerServer(bootreg);
+ } else if (!booter_registered) {
+ boot.reset(booter);
+ booter_registered = true;
+ } else {
+ throw std::runtime_error("rpcmanager: Aggregator not in use, and a rpc booter is "
+ "already registered\n");
+ }
}
diff --git a/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc
index e81a899626..6a2f6c80e4 100644
--- a/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc
+++ b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc
@@ -26,87 +26,83 @@
#include <sstream>
#include <stdexcept>
-rpcserver_aggregator::rpcserver_aggregator()
- : d_type(std::string("aggregator"))
-{;}
+rpcserver_aggregator::rpcserver_aggregator() : d_type(std::string("aggregator")) { ; }
-rpcserver_aggregator::~rpcserver_aggregator()
-{;}
+rpcserver_aggregator::~rpcserver_aggregator() { ; }
-const std::string&
-rpcserver_aggregator::type()
-{
- return d_type;
-}
+const std::string& rpcserver_aggregator::type() { return d_type; }
-const std::vector<std::string>&
-rpcserver_aggregator::registeredServers()
+const std::vector<std::string>& rpcserver_aggregator::registeredServers()
{
- return d_registeredServers;
+ return d_registeredServers;
}
-void
-rpcserver_aggregator::registerConfigureCallback(const std::string &id,
- const configureCallback_t callback)
+void rpcserver_aggregator::registerConfigureCallback(const std::string& id,
+ const configureCallback_t callback)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- registerConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, configureCallback_t>(id, callback));
+ std::for_each(d_serverlist.begin(),
+ d_serverlist.end(),
+ registerConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ configureCallback_t>(id, callback));
}
-void
-rpcserver_aggregator::unregisterConfigureCallback(const std::string &id)
+void rpcserver_aggregator::unregisterConfigureCallback(const std::string& id)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- unregisterConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, configureCallback_t>(id));
+ std::for_each(
+ d_serverlist.begin(),
+ d_serverlist.end(),
+ unregisterConfigureCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ configureCallback_t>(id));
}
-void
-rpcserver_aggregator::registerQueryCallback(const std::string &id, const queryCallback_t callback)
+void rpcserver_aggregator::registerQueryCallback(const std::string& id,
+ const queryCallback_t callback)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- registerQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, queryCallback_t>(id, callback));
+ std::for_each(d_serverlist.begin(),
+ d_serverlist.end(),
+ registerQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ queryCallback_t>(id, callback));
}
-void
-rpcserver_aggregator::unregisterQueryCallback(const std::string &id)
+void rpcserver_aggregator::unregisterQueryCallback(const std::string& id)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- unregisterQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, queryCallback_t>(id));
+ std::for_each(d_serverlist.begin(),
+ d_serverlist.end(),
+ unregisterQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ queryCallback_t>(id));
}
-
-void
-rpcserver_aggregator::registerHandlerCallback(const std::string &id,
- const handlerCallback_t callback)
+void rpcserver_aggregator::registerHandlerCallback(const std::string& id,
+ const handlerCallback_t callback)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- registerHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, handlerCallback_t>(id, callback));
+ std::for_each(d_serverlist.begin(),
+ d_serverlist.end(),
+ registerHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ handlerCallback_t>(id, callback));
}
-void
-rpcserver_aggregator::unregisterHandlerCallback(const std::string &id)
+void rpcserver_aggregator::unregisterHandlerCallback(const std::string& id)
{
- std::for_each(d_serverlist.begin(), d_serverlist.end(),
- unregisterHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, handlerCallback_t>(id));
+ std::for_each(d_serverlist.begin(),
+ d_serverlist.end(),
+ unregisterHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr,
+ handlerCallback_t>(id));
}
-
-void
-rpcserver_aggregator::registerServer(rpcmanager_base::rpcserver_booter_base_sptr server)
+void rpcserver_aggregator::registerServer(
+ rpcmanager_base::rpcserver_booter_base_sptr server)
{
- std::vector<std::string>::iterator it(std::find(d_registeredServers.begin(),
- d_registeredServers.end(),
- server->type()));
- if(it != d_registeredServers.end()) {
- d_serverlist.push_back(server);
- d_registeredServers.push_back(server->type());
- }
- else {
- std::stringstream s;
- s << "rpcserver_aggregator::registerServer: server of type "
- << server->type() << " already registered" << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
+ std::vector<std::string>::iterator it(std::find(
+ d_registeredServers.begin(), d_registeredServers.end(), server->type()));
+ if (it != d_registeredServers.end()) {
+ d_serverlist.push_back(server);
+ d_registeredServers.push_back(server->type());
+ } else {
+ std::stringstream s;
+ s << "rpcserver_aggregator::registerServer: server of type " << server->type()
+ << " already registered" << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
}
diff --git a/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc b/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc
index a1983b4ac5..de83f7af7c 100644
--- a/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc
+++ b/gnuradio-runtime/lib/controlport/rpcserver_booter_aggregator.cc
@@ -22,42 +22,28 @@
#include <gnuradio/rpcserver_booter_aggregator.h>
-rpcserver_booter_aggregator::rpcserver_booter_aggregator() :
- d_type(std::string("aggregator")),
- server(new rpcserver_aggregator())
-{;}
-
-rpcserver_booter_aggregator::~rpcserver_booter_aggregator()
-{;}
-
-rpcserver_base*
-rpcserver_booter_aggregator::i()
+rpcserver_booter_aggregator::rpcserver_booter_aggregator()
+ : d_type(std::string("aggregator")), server(new rpcserver_aggregator())
{
- return &(*server);
+ ;
}
-const std::string&
-rpcserver_booter_aggregator::type()
-{
- return d_type;
-}
+rpcserver_booter_aggregator::~rpcserver_booter_aggregator() { ; }
-const std::vector<std::string>
-rpcserver_booter_aggregator::endpoints()
-{
- std::vector<std::string> ep;
- ep.push_back(std::string("TODO"));
- return ep;
-}
+rpcserver_base* rpcserver_booter_aggregator::i() { return &(*server); }
-const std::vector<std::string>&
-rpcserver_booter_aggregator::registeredServers()
+const std::string& rpcserver_booter_aggregator::type() { return d_type; }
+
+const std::vector<std::string> rpcserver_booter_aggregator::endpoints()
{
- return server->registeredServers();
+ std::vector<std::string> ep;
+ ep.push_back(std::string("TODO"));
+ return ep;
}
-rpcserver_aggregator*
-rpcserver_booter_aggregator::agg()
+const std::vector<std::string>& rpcserver_booter_aggregator::registeredServers()
{
- return &(*server);
+ return server->registeredServers();
}
+
+rpcserver_aggregator* rpcserver_booter_aggregator::agg() { return &(*server); }
diff --git a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc
index 2785513a46..7d2453fd36 100644
--- a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc
+++ b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc
@@ -35,7 +35,7 @@ rpcmanager manager_instance;
#endif
#ifdef GR_RPCSERVER_ICE
- #error TODO ICE
+#error TODO ICE
#endif
#ifdef GR_RPCSERVER_THRIFT
@@ -44,9 +44,9 @@ rpcmanager::rpcserver_booter_register_helper<rpcserver_booter_thrift> boot_thrif
#endif
#ifdef GR_RPCSERVER_ERLANG
- #error TODO ERLANG
+#error TODO ERLANG
#endif
#ifdef GR_RPCSERVER_XMLRPC
- #error TODO XMLRPC
+#error TODO XMLRPC
#endif
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
index cc8804f79d..05bb936f5a 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
@@ -25,279 +25,249 @@
#include "thrift/gnuradio_types.h"
#include <iostream>
-GNURadio::Knob
-rpcpmtconverter::from_pmt(const pmt::pmt_t& knob)
+GNURadio::Knob rpcpmtconverter::from_pmt(const pmt::pmt_t& knob)
{
- if(pmt::is_real(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::DOUBLE;
- result.value.__set_a_double(pmt::to_double(knob));
- return result;
- }
- else if(pmt::is_symbol(knob)) {
- std::string value = pmt::symbol_to_string(knob);
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::STRING;
- result.value.__set_a_string(value);
- return result;
- }
- else if(pmt::is_integer(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::LONG;
- result.value.__set_a_long(pmt::to_long(knob));
- return result;
- }
- else if(pmt::is_bool(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::BOOL;
- result.value.__set_a_bool(pmt::to_bool(knob));
- return result;
- }
- else if(pmt::is_uint64(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::LONG;
- result.value.__set_a_long(pmt::to_uint64(knob));
- return result;
- }
- else if(pmt::is_complex(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::COMPLEX;
- std::complex<double> tmp = pmt::to_complex(knob);
- GNURadio::complex cpx;
- cpx.re = tmp.real();
- cpx.im = tmp.imag();
- result.value.__set_a_complex(cpx);
- return result;
- }
- else if(pmt::is_f32vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::F32VECTOR;
- size_t size(pmt::length(knob));
- const float* start((const float*)pmt::f32vector_elements(knob,size));
- result.value.__set_a_f32vector(std::vector<double>(start,start+size));
- return result;
- }
- else if(pmt::is_f64vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::F64VECTOR;
- size_t size(pmt::length(knob));
- const double* start((const double*)pmt::f64vector_elements(knob,size));
- result.value.__set_a_f64vector(std::vector<double>(start,start+size));
- return result;
- }
- else if(pmt::is_s64vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::S64VECTOR;
- size_t size(pmt::length(knob));
- const int64_t* start((const int64_t*)pmt::s64vector_elements(knob,size));
- result.value.__set_a_s64vector(std::vector<int64_t>(start,start+size));
- return result;
- }
- else if(pmt::is_s32vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::S32VECTOR;
- size_t size(pmt::length(knob));
- const int32_t* start((const int32_t*)pmt::s32vector_elements(knob,size));
- result.value.__set_a_s32vector(std::vector<int32_t>(start,start+size));
- return result;
- }
- else if(pmt::is_s16vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::S16VECTOR;
- size_t size(pmt::length(knob));
- const int16_t* start((const int16_t*)pmt::s16vector_elements(knob,size));
- result.value.__set_a_s16vector(std::vector<int16_t>(start,start+size));
- return result;
- }
- else if(pmt::is_s8vector(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::S8VECTOR;
- size_t size(pmt::length(knob));
- const int8_t* start((const int8_t*)pmt::s8vector_elements(knob,size));
- result.value.__set_a_s8vector(std::basic_string<char>(start,start+size));
- return result;
- }
- else if(pmt::is_c32vector(knob)) {
- std::vector< GNURadio::complex > z;
+ if (pmt::is_real(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::DOUBLE;
+ result.value.__set_a_double(pmt::to_double(knob));
+ return result;
+ } else if (pmt::is_symbol(knob)) {
+ std::string value = pmt::symbol_to_string(knob);
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::STRING;
+ result.value.__set_a_string(value);
+ return result;
+ } else if (pmt::is_integer(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::LONG;
+ result.value.__set_a_long(pmt::to_long(knob));
+ return result;
+ } else if (pmt::is_bool(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::BOOL;
+ result.value.__set_a_bool(pmt::to_bool(knob));
+ return result;
+ } else if (pmt::is_uint64(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::LONG;
+ result.value.__set_a_long(pmt::to_uint64(knob));
+ return result;
+ } else if (pmt::is_complex(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::COMPLEX;
+ std::complex<double> tmp = pmt::to_complex(knob);
+ GNURadio::complex cpx;
+ cpx.re = tmp.real();
+ cpx.im = tmp.imag();
+ result.value.__set_a_complex(cpx);
+ return result;
+ } else if (pmt::is_f32vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::F32VECTOR;
+ size_t size(pmt::length(knob));
+ const float* start((const float*)pmt::f32vector_elements(knob, size));
+ result.value.__set_a_f32vector(std::vector<double>(start, start + size));
+ return result;
+ } else if (pmt::is_f64vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::F64VECTOR;
+ size_t size(pmt::length(knob));
+ const double* start((const double*)pmt::f64vector_elements(knob, size));
+ result.value.__set_a_f64vector(std::vector<double>(start, start + size));
+ return result;
+ } else if (pmt::is_s64vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::S64VECTOR;
+ size_t size(pmt::length(knob));
+ const int64_t* start((const int64_t*)pmt::s64vector_elements(knob, size));
+ result.value.__set_a_s64vector(std::vector<int64_t>(start, start + size));
+ return result;
+ } else if (pmt::is_s32vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::S32VECTOR;
+ size_t size(pmt::length(knob));
+ const int32_t* start((const int32_t*)pmt::s32vector_elements(knob, size));
+ result.value.__set_a_s32vector(std::vector<int32_t>(start, start + size));
+ return result;
+ } else if (pmt::is_s16vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::S16VECTOR;
+ size_t size(pmt::length(knob));
+ const int16_t* start((const int16_t*)pmt::s16vector_elements(knob, size));
+ result.value.__set_a_s16vector(std::vector<int16_t>(start, start + size));
+ return result;
+ } else if (pmt::is_s8vector(knob)) {
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::S8VECTOR;
+ size_t size(pmt::length(knob));
+ const int8_t* start((const int8_t*)pmt::s8vector_elements(knob, size));
+ result.value.__set_a_s8vector(std::basic_string<char>(start, start + size));
+ return result;
+ } else if (pmt::is_c32vector(knob)) {
+ std::vector<GNURadio::complex> z;
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::C32VECTOR;
- size_t size(pmt::length(knob));
- const gr_complex* start((const gr_complex*)pmt::c32vector_elements(knob,size));
- for(size_t s = 0; s < size; s++) {
- GNURadio::complex z0;
- gr_complex z1 = gr_complex(*(start+s));
- z0.__set_re(z1.real());
- z0.__set_im(z1.imag());
- z.push_back(z0);
+ GNURadio::Knob result;
+ result.type = GNURadio::BaseTypes::C32VECTOR;
+ size_t size(pmt::length(knob));
+ const gr_complex* start((const gr_complex*)pmt::c32vector_elements(knob, size));
+ for (size_t s = 0; s < size; s++) {
+ GNURadio::complex z0;
+ gr_complex z1 = gr_complex(*(start + s));
+ z0.__set_re(z1.real());
+ z0.__set_im(z1.imag());
+ z.push_back(z0);
+ }
+ result.value.__set_a_c32vector(z);
+ return result;
+ } else {
+ std::cerr << "Error: Don't know how to handle Knob Type (from): " << knob
+ << std::endl;
+ assert(0);
}
- result.value.__set_a_c32vector(z);
- return result;
- }
- else {
- std::cerr << "Error: Don't know how to handle Knob Type (from): " << knob << std::endl;
- assert(0);
- }
- return GNURadio::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);
+ 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);
+ 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);
+ 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::from_long(knob.value.a_long);
+ return pmt::from_long(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);
+ 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);
+ return pmt::string_to_symbol(knob.value.a_string);
}
-pmt::pmt_t
-rpcpmtconverter::to_pmt_bool_f::operator()(const GNURadio::Knob& knob)
+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;
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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()));
+ 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;
- for(vitr = v0.begin(); vitr != v0.end(); vitr++) {
- v.push_back(gr_complex(vitr->re, vitr->im));
- }
- return pmt::init_c32vector(v.size(), v);
+ std::vector<GNURadio::complex> v0 = knob.value.a_c32vector;
+ std::vector<GNURadio::complex>::iterator vitr;
+ std::vector<gr_complex> v;
+ for (vitr = v0.begin(); vitr != v0.end(); vitr++) {
+ v.push_back(gr_complex(vitr->re, vitr->im));
+ }
+ return pmt::init_c32vector(v.size(), v);
}
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>
+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_F>(instance.to_pmt_map)(type);
+ 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)
+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);
- return pmt::pmt_t();
+ std::cerr << "Error: Don't know how to handle Knob Type: " << knob.type << std::endl;
+ assert(0);
+ return pmt::pmt_t();
}
-pmt::pmt_t
-rpcpmtconverter::To_PMT::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_booter_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
index 1d6cafe0c0..a5017cd17a 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
@@ -26,108 +26,120 @@
#include <boost/asio/ip/host_name.hpp>
namespace {
- static const char* const CONTROL_PORT_CLASS("thrift");
- static const unsigned int ETHERNET_HEADER_SIZE(14);
- static const unsigned int IP_HEADER_SIZE(20);
- static const unsigned int TCP_HEADER_SIZE(32);
- static const unsigned int ETHERNET_TYPICAL_MTU(1500);
- static const unsigned int ALRIGHT_DEFAULT_BUFFER_SIZE(
- ETHERNET_TYPICAL_MTU - ETHERNET_HEADER_SIZE - IP_HEADER_SIZE - TCP_HEADER_SIZE);
-};
+static const char* const CONTROL_PORT_CLASS("thrift");
+static const unsigned int ETHERNET_HEADER_SIZE(14);
+static const unsigned int IP_HEADER_SIZE(20);
+static const unsigned int TCP_HEADER_SIZE(32);
+static const unsigned int ETHERNET_TYPICAL_MTU(1500);
+static const unsigned int ALRIGHT_DEFAULT_BUFFER_SIZE(ETHERNET_TYPICAL_MTU -
+ ETHERNET_HEADER_SIZE -
+ IP_HEADER_SIZE - TCP_HEADER_SIZE);
+}; // namespace
/*!
* \brief A booter implementation for a Thrift application class.
*/
-rpcserver_booter_thrift::rpcserver_booter_thrift() :
- thrift_server_template<rpcserver_base,
- rpcserver_thrift,
- rpcserver_booter_thrift>(this),
- d_type(std::string(CONTROL_PORT_CLASS))
-{;}
+rpcserver_booter_thrift::rpcserver_booter_thrift()
+ : thrift_server_template<rpcserver_base, rpcserver_thrift, rpcserver_booter_thrift>(
+ this),
+ d_type(std::string(CONTROL_PORT_CLASS))
+{
+ ;
+}
-rpcserver_booter_thrift::~rpcserver_booter_thrift()
-{;}
+rpcserver_booter_thrift::~rpcserver_booter_thrift() { ; }
-rpcserver_base*
-rpcserver_booter_thrift::i()
+rpcserver_base* rpcserver_booter_thrift::i()
{
- return thrift_server_template<rpcserver_base, rpcserver_thrift,
- rpcserver_booter_thrift>::i();
+ return thrift_server_template<rpcserver_base,
+ rpcserver_thrift,
+ rpcserver_booter_thrift>::i();
}
/*!
* \brief Returns the endpoint string for the application
*/
-const std::vector<std::string>
-rpcserver_booter_thrift::endpoints()
+const std::vector<std::string> rpcserver_booter_thrift::endpoints()
{
- return thrift_server_template<rpcserver_base, rpcserver_thrift,
- rpcserver_booter_thrift>::endpoints();
+ return thrift_server_template<rpcserver_base,
+ rpcserver_thrift,
+ rpcserver_booter_thrift>::endpoints();
}
// Specialized thrift_application_base attributes and functions
// for this rpcserver_booter instance.
-template<class rpcserver_base, class rpcserver_booter_thrift>
-const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::d_default_max_init_attempts(100U);
+template <class rpcserver_base, class rpcserver_booter_thrift>
+const unsigned int
+ thrift_application_base<rpcserver_base,
+ rpcserver_booter_thrift>::d_default_max_init_attempts(100U);
-template<class rpcserver_base, class rpcserver_booter_thrift>
-const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::d_default_thrift_port(0U);
+template <class rpcserver_base, class rpcserver_booter_thrift>
+const unsigned int
+ thrift_application_base<rpcserver_base,
+ rpcserver_booter_thrift>::d_default_thrift_port(0U);
-template<class rpcserver_base, class rpcserver_booter_thrift>
-const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::d_default_num_thrift_threads(10U);
+template <class rpcserver_base, class rpcserver_booter_thrift>
+const unsigned int
+ thrift_application_base<rpcserver_base,
+ rpcserver_booter_thrift>::d_default_num_thrift_threads(10U);
-template<class rpcserver_base, class rpcserver_booter_thrift>
-const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::d_default_thrift_buffer_size(
- ALRIGHT_DEFAULT_BUFFER_SIZE);
+template <class rpcserver_base, class rpcserver_booter_thrift>
+const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::
+ d_default_thrift_buffer_size(ALRIGHT_DEFAULT_BUFFER_SIZE);
-template<class rpcserver_base, class rpcserver_booter_thrift>
+template <class rpcserver_base, class rpcserver_booter_thrift>
boost::scoped_ptr<thrift_application_base_impl>
- thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::p_impl(
- new thrift_application_base_impl());
+ thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::p_impl(
+ new thrift_application_base_impl());
-template<class rpcserver_base, class rpcserver_booter_thrift>
-thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::~thrift_application_base()
+template <class rpcserver_base, class rpcserver_booter_thrift>
+thrift_application_base<rpcserver_base,
+ rpcserver_booter_thrift>::~thrift_application_base()
{
- if(d_thirft_is_running) {
- d_thriftserver->stop();
- d_thirft_is_running = false;
- }
+ if (d_thirft_is_running) {
+ d_thriftserver->stop();
+ d_thirft_is_running = false;
+ }
}
-template<class rpcserver_base, class rpcserver_booter_thrift>
+template <class rpcserver_base, class rpcserver_booter_thrift>
void thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::start_thrift()
{
- d_thriftserver->serve();
+ d_thriftserver->serve();
}
-template<class rpcserver_base, typename rpcserver_booter_thrift>
-bool thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::application_started()
+template <class rpcserver_base, typename rpcserver_booter_thrift>
+bool thrift_application_base<rpcserver_base,
+ rpcserver_booter_thrift>::application_started()
{
- if (d_thirft_is_running) return true;
+ if (d_thirft_is_running)
+ return true;
- bool result(false);
- // Define the endpoint.
- apache::thrift::transport::TServerTransport *thetransport =
- d_thriftserver->getServerTransport().get();
+ bool result(false);
+ // Define the endpoint.
+ apache::thrift::transport::TServerTransport* thetransport =
+ d_thriftserver->getServerTransport().get();
- // Determine the specified endpoint port number, or the port number selected by bind() if
- int used_port = ((apache::thrift::transport::TServerSocket*)thetransport)->getPort();
+ // Determine the specified endpoint port number, or the port number selected by bind()
+ // if
+ int used_port = ((apache::thrift::transport::TServerSocket*)thetransport)->getPort();
- if (used_port > 0) {
- // Determine the hostname of this host
- const std::string boost_hostname(boost::asio::ip::host_name());
+ if (used_port > 0) {
+ // Determine the hostname of this host
+ const std::string boost_hostname(boost::asio::ip::host_name());
- std::string endpoint = boost::str(boost::format("-h %1% -p %2%") % boost_hostname % used_port);
+ std::string endpoint =
+ boost::str(boost::format("-h %1% -p %2%") % boost_hostname % used_port);
- set_endpoint(endpoint);
+ set_endpoint(endpoint);
- GR_LOG_INFO(d_logger, "Apache Thrift: " + endpoint);
- d_thirft_is_running = true;
- result = true;
- }
+ GR_LOG_INFO(d_logger, "Apache Thrift: " + endpoint);
+ d_thirft_is_running = true;
+ result = true;
+ }
- return result;
+ return result;
}
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
index 6b912bbfae..180bb85f3d 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc
@@ -37,239 +37,239 @@ using namespace rpcpmtconverter;
rpcserver_thrift::rpcserver_thrift()
{
- //std::cerr << "rpcserver_thrift::ctor" << std::endl;
+ // std::cerr << "rpcserver_thrift::ctor" << std::endl;
}
rpcserver_thrift::~rpcserver_thrift()
{
- //std::cerr << "rpcserver_thrift::dtor" << std::endl;
+ // std::cerr << "rpcserver_thrift::dtor" << std::endl;
}
-void
-rpcserver_thrift::registerConfigureCallback(const std::string &id,
- const configureCallback_t callback)
+void rpcserver_thrift::registerConfigureCallback(const std::string& id,
+ const configureCallback_t callback)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- {
- 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;
- throw std::runtime_error(s.str().c_str());
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ {
+ 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;
+ throw std::runtime_error(s.str().c_str());
+ }
}
- }
- if(DEBUG) {
- std::cerr << "rpcserver_thrift registering set: " << id << std::endl;
- }
- d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback));
+ if (DEBUG) {
+ std::cerr << "rpcserver_thrift registering set: " << id << std::endl;
+ }
+ d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback));
}
-void
-rpcserver_thrift::unregisterConfigureCallback(const std::string &id)
+void rpcserver_thrift::unregisterConfigureCallback(const std::string& id)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id));
- if(iter == d_setcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering set, not registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
-
- if(DEBUG)
- std::cerr << "rpcserver_thrift unregistering set: " << id << std::endl;
-
- d_setcallbackmap.erase(iter);
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id));
+ if (iter == d_setcallbackmap.end()) {
+ std::stringstream s;
+ s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering set, not "
+ "registered: "
+ << id << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
+
+ if (DEBUG)
+ std::cerr << "rpcserver_thrift unregistering set: " << id << std::endl;
+
+ d_setcallbackmap.erase(iter);
}
-void
-rpcserver_thrift::registerQueryCallback(const std::string &id,
- const queryCallback_t callback)
+void rpcserver_thrift::registerQueryCallback(const std::string& id,
+ const queryCallback_t callback)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- {
- QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id));
- if(iter != d_getcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR registering get, already registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ {
+ QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id));
+ if (iter != d_getcallbackmap.end()) {
+ std::stringstream s;
+ s << "rpcserver_thrift:: rpcserver_thrift ERROR registering get, already "
+ "registered: "
+ << id << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
}
- }
- if(DEBUG) {
- std::cerr << "rpcserver_thrift registering get: " << id << std::endl;
- }
- d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback));
+ if (DEBUG) {
+ std::cerr << "rpcserver_thrift registering get: " << id << std::endl;
+ }
+ d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback));
}
-void
-rpcserver_thrift::unregisterQueryCallback(const std::string &id)
+void rpcserver_thrift::unregisterQueryCallback(const std::string& id)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id));
- if(iter == d_getcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering get, registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
-
- if(DEBUG) {
- std::cerr << "rpcserver_thrift unregistering get: " << id << std::endl;
- }
-
- d_getcallbackmap.erase(iter);
-}
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id));
+ if (iter == d_getcallbackmap.end()) {
+ std::stringstream s;
+ s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering get, registered: "
+ << id << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
+
+ if (DEBUG) {
+ std::cerr << "rpcserver_thrift unregistering get: " << id << std::endl;
+ }
+ d_getcallbackmap.erase(iter);
+}
-void
-rpcserver_thrift::registerHandlerCallback(const std::string &id,
- const handlerCallback_t callback)
+void rpcserver_thrift::registerHandlerCallback(const std::string& id,
+ const handlerCallback_t callback)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- {
- HandlerCallbackMap_t::const_iterator iter(d_handlercallbackmap.find(id));
- if(iter != d_handlercallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR registering handler, already registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ {
+ HandlerCallbackMap_t::const_iterator iter(d_handlercallbackmap.find(id));
+ if (iter != d_handlercallbackmap.end()) {
+ std::stringstream s;
+ s << "rpcserver_thrift:: rpcserver_thrift ERROR registering handler, already "
+ "registered: "
+ << id << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
}
- }
- if(DEBUG) {
- std::cerr << "rpcserver_thrift registering handler: " << id << std::endl;
- }
- d_handlercallbackmap.insert(HandlerCallbackMap_t::value_type(id, callback));
+ if (DEBUG) {
+ std::cerr << "rpcserver_thrift registering handler: " << id << std::endl;
+ }
+ d_handlercallbackmap.insert(HandlerCallbackMap_t::value_type(id, callback));
}
-void
-rpcserver_thrift::unregisterHandlerCallback(const std::string &id)
+void rpcserver_thrift::unregisterHandlerCallback(const std::string& id)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- HandlerCallbackMap_t::iterator iter(d_handlercallbackmap.find(id));
- if(iter == d_handlercallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering handler, registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
-
- if(DEBUG) {
- std::cerr << "rpcserver_thrift unregistering handler: " << id << std::endl;
- }
-
- d_handlercallbackmap.erase(iter);
-}
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ HandlerCallbackMap_t::iterator iter(d_handlercallbackmap.find(id));
+ if (iter == d_handlercallbackmap.end()) {
+ std::stringstream s;
+ s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering handler, "
+ "registered: "
+ << id << std::endl;
+ throw std::runtime_error(s.str().c_str());
+ }
+ if (DEBUG) {
+ std::cerr << "rpcserver_thrift unregistering handler: " << id << std::endl;
+ }
+ d_handlercallbackmap.erase(iter);
+}
-void
-rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs)
+void rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- std::for_each(knobs.begin(), knobs.end(),
- set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t>
- (d_setcallbackmap, cur_priv));
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ std::for_each(knobs.begin(),
+ knobs.end(),
+ set_f<GNURadio::KnobMap::value_type, ConfigureCallbackMap_t>(
+ d_setcallbackmap, cur_priv));
}
-void
-rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return,
- const GNURadio::KnobIDList& knobs)
+void rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return,
+ const GNURadio::KnobIDList& knobs)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- 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, _return));
- }
- else {
- std::for_each(knobs.begin(), knobs.end(),
- get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
- (d_getcallbackmap, cur_priv, _return));
- }
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ 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, _return));
+ } else {
+ std::for_each(knobs.begin(),
+ knobs.end(),
+ get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>(
+ d_getcallbackmap, cur_priv, _return));
+ }
}
-void
-rpcserver_thrift::getRe(GNURadio::KnobMap& _return, const GNURadio::KnobIDList& knobs)
+void rpcserver_thrift::getRe(GNURadio::KnobMap& _return,
+ const GNURadio::KnobIDList& knobs)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- 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, _return));
- }
- else {
- QueryCallbackMap_t::iterator it;
- for(it = d_getcallbackmap.begin(); it != d_getcallbackmap.end(); it++){
- 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)) {
- get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
- (d_getcallbackmap, cur_priv, _return)(it->first);
- break;
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ 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, _return));
+ } else {
+ QueryCallbackMap_t::iterator it;
+ for (it = d_getcallbackmap.begin(); it != d_getcallbackmap.end(); it++) {
+ 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)) {
+ get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>(
+ d_getcallbackmap, cur_priv, _return)(it->first);
+ break;
+ }
+ }
}
- }
}
- }
}
-void
-rpcserver_thrift::properties(GNURadio::KnobPropMap& _return,
- const GNURadio::KnobIDList& knobs)
+void rpcserver_thrift::properties(GNURadio::KnobPropMap& _return,
+ const GNURadio::KnobIDList& knobs)
{
- boost::mutex::scoped_lock lock(d_callback_map_lock);
- 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, _return));
- }
- else {
- std::for_each(knobs.begin(), knobs.end(),
- properties_f<GNURadio::KnobIDList::value_type,
- QueryCallbackMap_t, GNURadio::KnobPropMap>(d_getcallbackmap,
- cur_priv, _return));
- }
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+ 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, _return));
+ } else {
+ std::for_each(
+ knobs.begin(),
+ knobs.end(),
+ properties_f<GNURadio::KnobIDList::value_type,
+ QueryCallbackMap_t,
+ GNURadio::KnobPropMap>(d_getcallbackmap, cur_priv, _return));
+ }
}
-void
-rpcserver_thrift::postMessage(const std::string& alias,
- const std::string& port,
- const std::string& msg)
+void rpcserver_thrift::postMessage(const std::string& alias,
+ const std::string& port,
+ const std::string& msg)
{
- // alias and port are received as serialized PMT strings and need to
- // be deserialized into PMTs and then the actual info from there.
- // The actual message (msg) is also received as a serialized PMT. We
- // just need to get the PMT itself out of this to pass to the set_h
- // function for handling the message post.
-
- boost::mutex::scoped_lock lock(d_callback_map_lock);
-
- pmt::pmt_t alias_pmt = pmt::deserialize_str(alias);
- pmt::pmt_t port_pmt = pmt::deserialize_str(port);
- pmt::pmt_t msg_pmt = pmt::deserialize_str(msg);
- std::string alias_str = pmt::symbol_to_string(alias_pmt);
- std::string port_str = pmt::symbol_to_string(port_pmt);
- std::string iface = alias_str + "::" + port_str;
-
- HandlerCallbackMap_t::iterator itr = d_handlercallbackmap.begin();
- for(; itr != d_handlercallbackmap.end(); itr++) {
- if(iface == (*itr).first) {
- set_h((*itr).second, cur_priv, port_pmt, msg_pmt);
+ // alias and port are received as serialized PMT strings and need to
+ // be deserialized into PMTs and then the actual info from there.
+ // The actual message (msg) is also received as a serialized PMT. We
+ // just need to get the PMT itself out of this to pass to the set_h
+ // function for handling the message post.
+
+ boost::mutex::scoped_lock lock(d_callback_map_lock);
+
+ pmt::pmt_t alias_pmt = pmt::deserialize_str(alias);
+ pmt::pmt_t port_pmt = pmt::deserialize_str(port);
+ pmt::pmt_t msg_pmt = pmt::deserialize_str(msg);
+ std::string alias_str = pmt::symbol_to_string(alias_pmt);
+ std::string port_str = pmt::symbol_to_string(port_pmt);
+ std::string iface = alias_str + "::" + port_str;
+
+ HandlerCallbackMap_t::iterator itr = d_handlercallbackmap.begin();
+ for (; itr != d_handlercallbackmap.end(); itr++) {
+ if (iface == (*itr).first) {
+ set_h((*itr).second, cur_priv, port_pmt, msg_pmt);
+ }
}
- }
}
-void
-rpcserver_thrift::shutdown() {
- if (DEBUG) {
- std::cerr << "Shutting down..." << std::endl;
- }
+void rpcserver_thrift::shutdown()
+{
+ if (DEBUG) {
+ std::cerr << "Shutting down..." << std::endl;
+ }
}