23 #ifndef RPCREGISTERHELPERS_H 24 #define RPCREGISTERHELPERS_H 36 typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr;
49 template <
typename T,
typename Tto>
63 throw std::runtime_error(
64 "rpcextractor_base: no post defined for this data type.\n");
83 throw std::runtime_error(
84 "rpcextractor_base: no post defined for this data type.\n");
95 template <
typename T,
typename Tto>
115 template <
typename T,
typename Tfrom>
138 template <
typename T,
typename Tfrom>
170 template <
typename T>
191 template <
typename T>
210 template <
typename T>
231 template <
typename T>
252 template <
typename T>
273 template <
typename T>
294 template <
typename T>
315 template <
typename T>
336 template <
typename T>
357 template <
typename T>
378 template <
typename T>
392 std::complex<float> k =
static_cast<std::complex<float>
>(
pmt::to_complex(msg));
401 template <
typename T>
423 template <
typename T>
450 template <
typename T>
476 template <
typename T>
495 std::vector<signed char> vec(
505 template <
typename T>
533 template <
typename T>
561 template <
typename T>
580 std::vector<int64_t> vec(
590 template <
typename T>
609 std::vector<std::complex<float>> vec(
619 template <
typename T>
647 template <
typename T>
666 std::vector<uint8_t> vec(
676 template <
typename T>
704 template <
typename T>
723 std::complex<double> k(
733 template <
typename T>
787 template <
typename T,
typename Tto>
816 const char* functionbase,
817 void (T::*
function)(Tto),
821 const char* units_ =
"",
822 const char* desc_ =
"",
831 d_minpriv = minpriv_;
832 d_display = display_;
833 d_object =
dynamic_cast<T*
>(
835 #ifdef GR_RPCSERVER_ENABLED 845 std::ostringstream oss(std::ostringstream::out);
846 oss << block_alias <<
"::" << functionbase;
877 const char* functionbase,
879 void (T::*
function)(Tto),
883 const char* units_ =
"",
884 const char* desc_ =
"",
893 d_minpriv = minpriv_;
894 d_display = display_;
896 #ifdef GR_RPCSERVER_ENABLED 906 std::ostringstream oss(std::ostringstream::out);
907 oss << name <<
"::" << functionbase;
916 #ifdef GR_RPCSERVER_ENABLED 925 std::string
units()
const {
return d_units; }
933 void units(std::string u) { d_units = u; }
941 std::string d_units, d_desc;
972 template <
typename T>
996 const char* functionbase,
997 void (T::*
function)(),
998 const char* desc_ =
"",
1002 d_minpriv = minpriv_;
1003 d_object =
dynamic_cast<T*
>(
1005 #ifdef GR_RPCSERVER_ENABLED 1009 std::string(desc_));
1010 std::ostringstream oss(std::ostringstream::out);
1011 oss << block_alias <<
"::" << functionbase;
1037 const char* functionbase,
1039 void (T::*
function)(),
1040 const char* desc_ =
"",
1044 d_minpriv = minpriv_;
1046 #ifdef GR_RPCSERVER_ENABLED 1050 std::string(desc_));
1051 std::ostringstream oss(std::ostringstream::out);
1052 oss << name <<
"::" << functionbase;
1061 #ifdef GR_RPCSERVER_ENABLED 1116 template <
typename T,
typename Tfrom>
1147 const char* functionbase,
1148 Tfrom (T::*
function)(),
1152 const char* units_ =
"",
1153 const char* desc_ =
"",
1162 d_minpriv = minpriv_;
1163 d_display = display_;
1164 d_object =
dynamic_cast<T*
>(
1166 #ifdef GR_RPCSERVER_ENABLED 1170 std::string(units_),
1176 std::ostringstream oss(std::ostringstream::out);
1177 oss << block_alias <<
"::" << functionbase;
1190 const char* functionbase,
1191 Tfrom (T::*
function)()
const,
1195 const char* units_ =
"",
1196 const char* desc_ =
"",
1205 d_minpriv = minpriv_;
1206 d_display = display_;
1207 d_object =
dynamic_cast<T*
>(
1209 #ifdef GR_RPCSERVER_ENABLED 1213 std::string(units_),
1219 std::ostringstream oss(std::ostringstream::out);
1220 oss << block_alias <<
"::" << functionbase;
1253 const char* functionbase,
1255 Tfrom (T::*
function)(),
1259 const char* units_ =
"",
1260 const char* desc_ =
"",
1269 d_minpriv = minpriv_;
1270 d_display = display_;
1272 #ifdef GR_RPCSERVER_ENABLED 1276 std::string(units_),
1282 std::ostringstream oss(std::ostringstream::out);
1283 oss << name <<
"::" << functionbase;
1296 const char* functionbase,
1298 Tfrom (T::*
function)()
const,
1302 const char* units_ =
"",
1303 const char* desc_ =
"",
1312 d_minpriv = minpriv_;
1313 d_display = display_;
1315 #ifdef GR_RPCSERVER_ENABLED 1319 std::string(units_),
1325 std::ostringstream oss(std::ostringstream::out);
1326 oss << name <<
"::" << functionbase;
1336 #ifdef GR_RPCSERVER_ENABLED 1344 std::string
units()
const {
return d_units; }
1352 void units(std::string u) { d_units = u; }
1360 std::string d_units, d_desc;
1404 template <
typename Tfrom>
1410 Tfrom
get() {
return *d_variable; }
1435 throw std::runtime_error(
1436 "ERROR: rpcbasic_register_variable called with no args. If this happens, " 1437 "someone has tried to use rpcbasic_register_variable incorrectly.");
1459 const char* functionbase,
1464 const char* units_ =
"",
1465 const char* desc_ =
"",
1468 : d_rpc_reg(namebase,
1479 d_variable(variable)
1521 template <
typename Tfrom>
1532 : d_rpc_regset(
"FAIL",
1544 throw std::runtime_error(
1545 "ERROR: rpcbasic_register_variable_rw called with no args. if this happens " 1546 "someone used rpcbasic_register_variable_rw incorrectly.\n");
1549 void set(Tfrom _variable)
1573 const char* functionbase,
1578 const char* units_ =
"",
1579 const char* desc_ =
"",
1583 namebase, functionbase, variable, min, max, def, units_, desc_),
1584 d_rpc_regset(namebase,
1605 template <
typename T>
1626 const char* handler,
1627 const char* units_ =
"",
1628 const char* desc_ =
"",
1634 d_minpriv = minpriv_;
1635 d_display = display_;
1636 d_object =
dynamic_cast<T*
>(
1638 #ifdef GR_RPCSERVER_ENABLED 1642 std::string(units_),
1648 std::ostringstream oss(std::ostringstream::out);
1649 oss << block_alias <<
"::" << handler;
1658 #ifdef GR_RPCSERVER_ENABLED 1663 std::string
units()
const {
return d_units; }
1668 void units(std::string u) { d_units = u; }
1675 std::string d_units, d_desc;
Definition: rpcregisterhelpers.h:744
virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback)=0
Definition: rpccallbackregister_base.h:94
~rpcbasic_register_trigger()
Definition: rpcregisterhelpers.h:1059
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:607
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:466
PMT_API pmt_t from_complex(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
~rpchandler_base()
Definition: rpcregisterhelpers.h:178
rpcbasic_inserter(T *source, std::complex< double >(T::*func)())
Definition: rpcregisterhelpers.h:715
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:1341
T * _source
Definition: rpcregisterhelpers.h:183
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)
Same as above that allows using '[variable]() const' getter functions.
Definition: rpcregisterhelpers.h:1295
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1068
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)())
Definition: rpcregisterhelpers.h:487
PMT_API pmt_t init_s32vector(size_t k, const int32_t *data)
Templated parent class for registering a ControlPort Extractor.
Definition: rpcregisterhelpers.h:192
rpcbasic_register_variable()
Definition: rpcregisterhelpers.h:1421
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:636
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1670
PMT_API std::complex< double > to_complex(pmt_t z)
rpcbasic_inserter(T *source, std::vector< int >(T::*func)())
Definition: rpcregisterhelpers.h:544
T * _source
Definition: rpcregisterhelpers.h:129
rpcbasic_register_variable_rw()
Definition: rpcregisterhelpers.h:1531
rpcbasic_inserter(T *source, std::vector< std::complex< float >>(T::*func)() const)
Definition: rpcregisterhelpers.h:595
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:122
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:96
std::string description() const
Definition: rpcregisterhelpers.h:1664
float min(float a, float b)
rpcbasic_register_set(const std::string &block_alias, const char *functionbase, 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)
Adds the ability to set the variable over ControlPort.
Definition: rpcregisterhelpers.h:815
rpcbasic_inserter(T *source, std::vector< short >(T::*func)() const)
Definition: rpcregisterhelpers.h:510
PMT_API pmt_t init_u8vector(size_t k, const uint8_t *data)
rpcbasic_inserter(T *source, std::complex< float >(T::*func)())
Definition: rpcregisterhelpers.h:687
Tfrom * d_variable
Definition: rpcregisterhelpers.h:1409
void units(std::string u)
Definition: rpcregisterhelpers.h:1668
Registers a read/write function to get and set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1522
Base class for registering a ControlPort Handler. Acts as a message acceptor.
Definition: rpcregisterhelpers.h:171
rpcbasic_handler(T *source, const char *handler)
Definition: rpcregisterhelpers.h:195
rpcbasic_inserter(T *source, std::vector< int64_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:566
Base class for registering a ControlPort function.
Definition: rpcregisterhelpers.h:734
rpcbasic_inserter(T *source, std::vector< short >(T::*func)())
Definition: rpcregisterhelpers.h:516
PMT_API pmt_t init_s8vector(size_t k, const int8_t *data)
void description(std::string d)
Definition: rpcregisterhelpers.h:1070
Virtual base class that produces messages.
Definition: msg_producer.h:35
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:693
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1666
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)())
Definition: rpcregisterhelpers.h:658
priv_lvl_t
Definition: rpccallbackregister_base.h:46
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:936
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:578
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:923
Registers a message handler function to post a message to a block's handler.
Definition: rpcregisterhelpers.h:1606
void description(std::string d)
Definition: rpcregisterhelpers.h:1669
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1354
void units(std::string u)
Definition: rpcregisterhelpers.h:1352
Base class for registering a ControlPort Inserter. Produces a message.
Definition: rpcregisterhelpers.h:116
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:1342
PMT_API pmt_t intern(const std::string &s)
Alias for pmt_string_to_symbol.
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1346
virtual void unregisterConfigureCallback(const std::string &id)=0
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:493
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:664
PMT_API const std::string symbol_to_string(const pmt_t &sym)
rpcbasic_inserter(T *source, std::vector< std::complex< float >>(T::*func)())
Definition: rpcregisterhelpers.h:601
static int count
Definition: rpcregisterhelpers.h:738
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1350
PMT_API bool to_bool(pmt_t val)
Return true if val is pmt::True, return false when val is pmt::PMT_F,.
rpcbasic_inserter(T *source, uint64_t(T::*func)())
Definition: rpcregisterhelpers.h:460
Definition: rpccallbackregister_base.h:46
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:154
Registers a 'get' function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1117
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:935
Templated parent class for registering a ControlPort Inserter.
Definition: rpcregisterhelpers.h:139
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:550
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:922
std::string description() const
Definition: rpcregisterhelpers.h:1067
PMT_API pmt_t from_uint64(uint64_t x)
Return the pmt value that represents the uint64 x.
rpcbasic_register_variable_rw(const std::string &namebase, const char *functionbase, Tfrom *variable, 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)
Adds the ability to set and get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1572
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:924
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)
Adds the ability to set the variable over ControlPort.
Definition: rpcregisterhelpers.h:876
virtual ~rpcbasic_base()
Definition: rpcregisterhelpers.h:748
rpcbasic_register_handler(const std::string &block_alias, const char *handler, const char *units_="", const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN, DisplayType display_=DISPNULL)
Adds the ability to pass a message over ControlPort.
Definition: rpcregisterhelpers.h:1625
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1351
std::string units() const
Definition: rpcregisterhelpers.h:1663
rpchandler_base(T *source, const char *handler)
Definition: rpcregisterhelpers.h:174
std::string description() const
Definition: rpcregisterhelpers.h:926
virtual void unregisterQueryCallback(const std::string &id)=0
rpcbasic_register_variable(const std::string &namebase, const char *functionbase, Tfrom *variable, 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)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1458
rpcinserter_base(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:119
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)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1252
rpcbasic_inserter(T *source, std::vector< int64_t >(T::*func)())
Definition: rpcregisterhelpers.h:572
rpcbasic_register_get(const std::string &block_alias, const char *functionbase, 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)
Adds the ability to get the variable over ControlPort.
Definition: rpcregisterhelpers.h:1146
Virtual base class that accepts messages.
Definition: messages/msg_accepter.h:35
rpcbasic_inserter(T *source, uint64_t(T::*func)() const)
Definition: rpcregisterhelpers.h:454
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1671
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:931
PMT_API long to_long(pmt_t x)
Convert pmt to long if possible.
virtual rpcserver_base * i()=0
PMT_API double to_double(pmt_t x)
Convert pmt to double if possible.
void setptr(Tfrom *_variable)
Definition: rpcregisterhelpers.h:1413
virtual void unregisterHandlerCallback(const std::string &id)=0
static rpcserver_booter_base * get()
PMT_API pmt_t init_s64vector(size_t k, const int64_t *data)
#define PMT_NIL
Definition: pmt.h:134
rpcbasic_inserter(T *source, std::vector< float >(T::*func)())
Definition: rpcregisterhelpers.h:630
~rpcbasic_register_get()
Definition: rpcregisterhelpers.h:1334
std::string description() const
Definition: rpcregisterhelpers.h:1345
std::string units() const
Definition: rpcregisterhelpers.h:925
rpcbasic_inserter(T *source, std::vector< int >(T::*func)() const)
Definition: rpcregisterhelpers.h:538
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:1343
Registers a 'trigger' function to trigger an action over ControlPort.
Definition: rpcregisterhelpers.h:973
Registers a read-only function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1405
const uint32_t DISPNULL
DisplayType Plotting types.
Definition: rpccallbackregister_base.h:32
rpcbasic_inserter(T *source, std::vector< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:624
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:932
PMT_API pmt_t init_f32vector(size_t k, const float *data)
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:652
const char * _handler
Definition: rpcregisterhelpers.h:184
rpcbasic_register_get< rpcbasic_register_variable< Tfrom >, Tfrom > d_rpc_reg
Definition: rpcregisterhelpers.h:1408
virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)=0
rpcinserter_base()
Definition: rpcregisterhelpers.h:120
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:721
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1347
std::string units() const
Definition: rpcregisterhelpers.h:1344
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1665
PMT_API pmt_t init_c32vector(size_t k, const std::complex< float > *data)
GR_RUNTIME_API gr::block_registry global_block_registry
rpcbasic_inserter(T *source, std::complex< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:681
DisplayType default_display() const
Definition: rpcregisterhelpers.h:928
rpcbasic_register_get(const std::string &block_alias, const char *functionbase, 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)
Same as rpcbasic_register_get::rpcbasic_register_get that allows using '[variable]() const' getter fu...
Definition: rpcregisterhelpers.h:1189
rpcbasic_inserter(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:148
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:930
rpcbasic_base()
Definition: rpcregisterhelpers.h:747
rpcbasic_register_trigger(const std::string &name, const char *functionbase, T *obj, void(T::*function)(), const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN)
Adds the ability to trigger a function over ControlPort.
Definition: rpcregisterhelpers.h:1036
void units(std::string u)
Definition: rpcregisterhelpers.h:933
~rpcbasic_register_set()
Definition: rpcregisterhelpers.h:914
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1355
rpcbasic_inserter(T *source, std::complex< double >(T::*func)() const)
Definition: rpcregisterhelpers.h:709
void description(std::string d)
Definition: rpcregisterhelpers.h:934
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1349
rpcbasic_register_trigger(const std::string &block_alias, const char *functionbase, void(T::*function)(), const char *desc_="", priv_lvl_t minpriv_=RPC_PRIVLVL_MIN)
Adds the ability to trigger a function over ControlPort.
Definition: rpcregisterhelpers.h:995
rpc_register_base()
Definition: rpcregisterhelpers.h:735
~rpcbasic_register_handler()
Definition: rpcregisterhelpers.h:1656
PMT_API pmt_t init_s16vector(size_t k, const int16_t *data)
rpcbasic_inserter(T *source, Tfrom(T::*func)() const)
Definition: rpcregisterhelpers.h:142
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:180
basic_block_sptr block_lookup(pmt::pmt_t symbol)
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)() const)
Definition: rpcregisterhelpers.h:481
void description(std::string d)
Definition: rpcregisterhelpers.h:1353
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:522
static pmt_t mp(const std::string &s)
Make pmt symbol.
Definition: pmt_sugar.h:35
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:927
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1071
uint32_t DisplayType
Definition: rpccallbackregister_base.h:29
Registers a 'set' function to set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:788