summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-04 18:57:19 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-04 18:57:19 -0500
commit1162a912c71aeac4e3cce458c2806c402fac0ae8 (patch)
tree6d37be604eab7e9f0ac0cc601cf6901f3826624d /gnuradio-core/src/lib/runtime
parentba015f5bd2e35ec5a47aea3c92dd83785e264cb9 (diff)
ctrlport: adding back old (almost) style API for controlport.
Allows us to create controlport interfaces from a name and object pointer and not just the alias of a gr_basic_block.
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/rpcregisterhelpers.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h b/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h
index 2e3ac2d85c..9af1758186 100644
--- a/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h
+++ b/gnuradio-core/src/lib/runtime/rpcregisterhelpers.h
@@ -283,6 +283,7 @@ typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr;
template<typename T, typename Tto>
struct rpcbasic_register_set : public rpcbasic_base
{
+ // Function used to add a 'set' RPC call using a gr_basic_block's alias.
rpcbasic_register_set(const std::string& block_alias,
const char* functionbase,
void (T::*function)(Tto),
@@ -313,6 +314,38 @@ struct rpcbasic_register_set : public rpcbasic_base
#endif
}
+ // Function used to add a 'set' RPC call using a name and the object
+ rpcbasic_register_set(const std::string& name,
+ const char* functionbase,
+ T* obj,
+ void (T::*function)(Tto),
+ const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def,
+ const char* units_ = "",
+ const char* desc_ = "",
+ priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
+ DisplayType display_ = DISPNULL)
+ {
+ d_min = min;
+ d_max = max;
+ d_def = def;
+ d_units = units_;
+ d_desc = desc_;
+ d_minpriv = minpriv_;
+ d_display = display_;
+ d_object = obj;
+#ifdef RPCSERVER_ENABLED
+ callbackregister_base::configureCallback_t
+ extractor(new rpcbasic_extractor<T,Tto>(d_object, function),
+ minpriv_, std::string(units_),
+ display_, std::string(desc_), min, max, def);
+ std::ostringstream oss(std::ostringstream::out);
+ oss << name << "::" << functionbase;
+ d_id = oss.str();
+ //std::cerr << "REGISTERING SET: " << d_id << " " << desc_ << std::endl;
+ rpcmanager::get()->i()->registerConfigureCallback(d_id, extractor);
+#endif
+ }
+
~rpcbasic_register_set()
{
#ifdef RPCSERVER_ENABLED
@@ -351,6 +384,7 @@ template<typename T, typename Tfrom>
class rpcbasic_register_get : public rpcbasic_base
{
public:
+ // Function used to add a 'set' RPC call using a gr_basic_block's alias.
// primary constructor to allow for T get() functions
rpcbasic_register_get(const std::string& block_alias,
const char* functionbase,
@@ -380,6 +414,7 @@ public:
rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
#endif
}
+
// alternate constructor to allow for T get() const functions
rpcbasic_register_get(const std::string& block_alias,
@@ -411,6 +446,70 @@ public:
#endif
}
+ // Function used to add a 'set' RPC call using a name and the object
+ // primary constructor to allow for T get() functions
+ rpcbasic_register_get(const std::string& name,
+ const char* functionbase,
+ T* obj,
+ Tfrom (T::*function)(),
+ const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def,
+ const char* units_ = "",
+ const char* desc_ = "",
+ priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
+ DisplayType display_ = DISPNULL)
+ {
+ d_min = min;
+ d_max = max;
+ d_def = def;
+ d_units = units_;
+ d_desc = desc_;
+ d_minpriv = minpriv_;
+ d_display = display_;
+ d_object = obj;
+#ifdef RPCSERVER_ENABLED
+ callbackregister_base::queryCallback_t
+ inserter(new rpcbasic_inserter<T,Tfrom>(d_object, function),
+ minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
+ std::ostringstream oss(std::ostringstream::out);
+ oss << name << "::" << functionbase;
+ d_id = oss.str();
+ //std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl;
+ rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
+#endif
+ }
+
+
+ // alternate constructor to allow for T get() const functions
+ rpcbasic_register_get(const std::string& name,
+ const char* functionbase,
+ T* obj,
+ Tfrom (T::*function)() const,
+ const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def,
+ const char* units_ = "",
+ const char* desc_ = "",
+ priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN,
+ DisplayType display_ = DISPNULL)
+ {
+ d_min = min;
+ d_max = max;
+ d_def = def;
+ d_units = units_;
+ d_desc = desc_;
+ d_minpriv = minpriv_;
+ d_display = display_;
+ d_object = obj;
+#ifdef RPCSERVER_ENABLED
+ callbackregister_base::queryCallback_t
+ inserter(new rpcbasic_inserter<T,Tfrom>(d_object, (Tfrom (T::*)())function),
+ minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
+ std::ostringstream oss(std::ostringstream::out);
+ oss << name << "::" << functionbase;
+ d_id = oss.str();
+ //std::cerr << "REGISTERING GET CONST: " << d_id << " " << desc_ << " " << display_ << std::endl;
+ rpcmanager::get()->i()->registerQueryCallback(d_id, inserter);
+#endif
+ }
+
~rpcbasic_register_get()
{
#ifdef RPCSERVER_ENABLED