summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/include
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/include')
-rw-r--r--gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h2
-rw-r--r--gnuradio-runtime/include/gnuradio/rpcserver_thrift.h40
-rw-r--r--gnuradio-runtime/include/gnuradio/thrift_server_template.h64
3 files changed, 61 insertions, 45 deletions
diff --git a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
index 4c074f0d58..eeb5b35c4e 100644
--- a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_thrift.h
@@ -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/include/gnuradio/rpcserver_thrift.h b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
index 9f6faf1710..c09b0a1f80 100644
--- a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
+++ b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h
@@ -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
*
@@ -43,16 +43,21 @@ public:
rpcserver_thrift();
virtual ~rpcserver_thrift();
- void registerConfigureCallback(const std::string &id, const configureCallback_t callback);
+ void registerConfigureCallback(const std::string &id,
+ const configureCallback_t callback);
void unregisterConfigureCallback(const std::string &id);
- void registerQueryCallback(const std::string &id, const queryCallback_t callback);
+ void registerQueryCallback(const std::string &id,
+ const queryCallback_t callback);
void unregisterQueryCallback(const std::string &id);
void setKnobs(const GNURadio::KnobMap&);
- void getKnobs(GNURadio::KnobMap&, const GNURadio::KnobIDList&);
- void getRe(GNURadio::KnobMap&, const GNURadio::KnobIDList&);
- void properties(GNURadio::KnobPropMap&, const GNURadio::KnobIDList& knobs);
+ void getKnobs(GNURadio::KnobMap&,
+ const GNURadio::KnobIDList&);
+ void getRe(GNURadio::KnobMap&,
+ const GNURadio::KnobIDList&);
+ void properties(GNURadio::KnobPropMap&,
+ const GNURadio::KnobIDList& knobs);
virtual void shutdown();
private:
@@ -94,7 +99,7 @@ public:
};
template<typename T, typename TMap>
- struct get_f : public std::unary_function<T,void>
+ struct get_f : public std::unary_function<T,void>
{
get_f(TMap &_getcallbackmap, const priv_lvl_t &_cur_priv, GNURadio::KnobMap &_outknobs) :
d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
@@ -127,10 +132,10 @@ public:
};
template<typename T, typename TMap, typename TKnobMap>
- struct get_all_f : public std::unary_function<T,void>
+ struct get_all_f : public std::unary_function<T,void>
{
- get_all_f(TMap &_getcallbackmap, const priv_lvl_t &_cur_priv, TKnobMap &_outknobs) :
- d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
+ get_all_f(TMap &_getcallbackmap, const priv_lvl_t &_cur_priv, TKnobMap &_outknobs) :
+ d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
{;}
void operator()(const T& p)
@@ -151,11 +156,14 @@ public:
};
template<typename T, typename TMap, typename TKnobMap>
- struct properties_all_f : public std::unary_function<T,void>
+ struct properties_all_f : public std::unary_function<T,void>
{
- properties_all_f(QueryCallbackMap_t &_getcallbackmap, const priv_lvl_t &_cur_priv, GNURadio::KnobPropMap &_outknobs)
- :
- d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
+ properties_all_f(QueryCallbackMap_t &_getcallbackmap,
+ const priv_lvl_t &_cur_priv,
+ GNURadio::KnobPropMap &_outknobs)
+ : d_getcallbackmap(_getcallbackmap),
+ cur_priv(_cur_priv),
+ outknobs(_outknobs)
{;}
void operator()(const T& p)
@@ -185,8 +193,8 @@ public:
template<class T, typename TMap, typename TKnobMap>
struct properties_f : public std::unary_function<T,void>
{
- properties_f(TMap &_getcallbackmap, const priv_lvl_t &_cur_priv, TKnobMap &_outknobs) :
- d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
+ properties_f(TMap &_getcallbackmap, const priv_lvl_t &_cur_priv, TKnobMap &_outknobs) :
+ d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
{;}
void operator()(const T& p)
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index 5de0112c78..31c1316c63 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -69,20 +69,22 @@ private:
* of 512 bytes.
*
*/
- class TBufferedTransportFactory : public thrift::transport::TTransportFactory {
- public:
- TBufferedTransportFactory() : bufferSize(ALRIGHT_DEFAULT_BUFFER_SIZE) {;}
- TBufferedTransportFactory(const unsigned int _bufferSize) : bufferSize(_bufferSize) {;}
-
- virtual ~TBufferedTransportFactory() {}
-
- virtual boost::shared_ptr<thrift::transport::TTransport> getTransport(
- boost::shared_ptr<thrift::transport::TTransport> trans) {
- return boost::shared_ptr<thrift::transport::TTransport>(
- new thrift::transport::TBufferedTransport(trans, bufferSize));
- }
- private:
- unsigned int bufferSize;
+ class TBufferedTransportFactory : public thrift::transport::TTransportFactory
+ {
+ public:
+ TBufferedTransportFactory() : bufferSize(ALRIGHT_DEFAULT_BUFFER_SIZE) {;}
+ TBufferedTransportFactory(const unsigned int _bufferSize) : bufferSize(_bufferSize) {;}
+
+ virtual ~TBufferedTransportFactory() {}
+
+ virtual boost::shared_ptr<thrift::transport::TTransport> getTransport(
+ boost::shared_ptr<thrift::transport::TTransport> trans)
+ {
+ return boost::shared_ptr<thrift::transport::TTransport>
+ (new thrift::transport::TBufferedTransport(trans, bufferSize));
+ }
+ private:
+ unsigned int bufferSize;
};
};
@@ -109,24 +111,30 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr
boost::shared_ptr<thrift::protocol::TProtocolFactory>
protocolFactory(new thrift::protocol::TBinaryProtocolFactory());
- if(thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads <= 1)
- { // "Thrift: Single-threaded server"
- thrift_application_base<TserverBase, TImplClass>::d_thriftserver =
- new thrift::server::TSimpleServer(processor, serverTransport, transportFactory, protocolFactory);
- } else { // std::cout << "Thrift Multi-threaded server : " << d_default_num_thrift_threads << std::endl;
- boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager(
- thrift::concurrency::ThreadManager::newSimpleThreadManager(
- thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads));
+ if(thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads <= 1) {
+ // "Thrift: Single-threaded server"
+ thrift_application_base<TserverBase, TImplClass>::d_thriftserver =
+ new thrift::server::TSimpleServer(processor, serverTransport,
+ transportFactory, protocolFactory);
+ }
+ else {
+ // std::cout << "Thrift Multi-threaded server : " << d_default_num_thrift_threads << std::endl;
+ boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager
+ (thrift::concurrency::ThreadManager::newSimpleThreadManager
+ (thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads));
- boost::shared_ptr<thrift::concurrency::PlatformThreadFactory> threadFactory(
- boost::shared_ptr<thrift::concurrency::PlatformThreadFactory>(new thrift::concurrency::PlatformThreadFactory()));
+ boost::shared_ptr<thrift::concurrency::PlatformThreadFactory> threadFactory
+ (boost::shared_ptr<thrift::concurrency::PlatformThreadFactory>
+ (new thrift::concurrency::PlatformThreadFactory()));
- threadManager->threadFactory(threadFactory);
+ threadManager->threadFactory(threadFactory);
- threadManager->start();
+ threadManager->start();
- thrift_application_base<TserverBase, TImplClass>::d_thriftserver =
- new thrift::server::TThreadPoolServer(processor, serverTransport, transportFactory, protocolFactory, threadManager);
+ thrift_application_base<TserverBase, TImplClass>::d_thriftserver =
+ new thrift::server::TThreadPoolServer(processor, serverTransport,
+ transportFactory, protocolFactory,
+ threadManager);
}
d_server = handler.get();