diff options
author | Tim O'Shea <tim.oshea753@gmail.com> | 2013-05-30 00:53:58 -0400 |
---|---|---|
committer | Tim O'Shea <tim.oshea753@gmail.com> | 2013-05-30 00:53:58 -0400 |
commit | 7f121cf367a9ae5d26d26dda7e4b00890ffbe1dc (patch) | |
tree | b224db6400043e26b8c5beda59ee9af68a0aa186 | |
parent | d1b65f4125aee94442c68d53f503bb29cdc10330 (diff) |
runtime: adding getRe() method to ctrlport (get knobs whose key matches a list of regex expressions)
-rw-r--r-- | gnuradio-runtime/include/gnuradio/rpcserver_ice.h | 2 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/gnuradio.ice | 1 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_ice.cc | 27 |
3 files changed, 30 insertions, 0 deletions
diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_ice.h b/gnuradio-runtime/include/gnuradio/rpcserver_ice.h index c6c9d45717..f1e65bbbc8 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_ice.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_ice.h @@ -48,6 +48,8 @@ public: GNURadio::KnobMap get(const GNURadio::KnobIDList&, const Ice::Current&); + GNURadio::KnobMap getRe(const GNURadio::KnobIDList&, const Ice::Current&); + GNURadio::KnobPropMap properties(const GNURadio::KnobIDList&, const Ice::Current&); virtual void shutdown(const Ice::Current&); diff --git a/gnuradio-runtime/lib/controlport/gnuradio.ice b/gnuradio-runtime/lib/controlport/gnuradio.ice index 731cbea956..29ddc2bfbe 100644 --- a/gnuradio-runtime/lib/controlport/gnuradio.ice +++ b/gnuradio-runtime/lib/controlport/gnuradio.ice @@ -86,6 +86,7 @@ interface StreamReceiver { interface ControlPort { void set(KnobMap knobs); idempotent KnobMap get(KnobIDList knobs); + idempotent KnobMap getRe(KnobIDList knobs); idempotent KnobPropMap properties(KnobIDList knobs); void shutdown(); }; diff --git a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc index 045d7ba4f1..5409f5e931 100644 --- a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc @@ -27,6 +27,7 @@ #include <sstream> #include <stdexcept> #include <pmt/pmt.h> +#include <boost/xpressive/xpressive.hpp> #define DEBUG 0 @@ -121,6 +122,32 @@ rpcserver_ice::set(const GNURadio::KnobMap& knobs, const Ice::Current& c) } GNURadio::KnobMap +rpcserver_ice::getRe(const GNURadio::KnobIDList& knobs, const Ice::Current& c) +{ + 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> + (c, d_getcallbackmap, cur_priv, outknobs)); + } + 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> + (c, d_getcallbackmap, cur_priv, outknobs)(it->first); + break; + } + } + } + } + return outknobs; +} + +GNURadio::KnobMap rpcserver_ice::get(const GNURadio::KnobIDList& knobs, const Ice::Current& c) { GNURadio::KnobMap outknobs; |