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 /gnuradio-runtime/lib/controlport/rpcserver_ice.cc | |
parent | d1b65f4125aee94442c68d53f503bb29cdc10330 (diff) |
runtime: adding getRe() method to ctrlport (get knobs whose key matches a list of regex expressions)
Diffstat (limited to 'gnuradio-runtime/lib/controlport/rpcserver_ice.cc')
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_ice.cc | 27 |
1 files changed, 27 insertions, 0 deletions
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; |