23 #ifndef RPCREGISTERHELPERS_H
24 #define RPCREGISTERHELPERS_H
36 typedef boost::shared_ptr<rpcbasic_base> rpcbasic_sptr;
49 template<
typename T,
typename Tto>
59 throw std::runtime_error(
"rpcextractor_base: no post defined for this data type.\n");
77 throw std::runtime_error(
"rpcextractor_base: no post defined for this data type.\n");
88 template<
typename T,
typename Tto>
106 template<
typename T,
typename Tfrom>
125 template<
typename T,
typename Tfrom>
165 _source->post(which_port, msg);
351 std::complex<float> k =
static_cast<std::complex<float>
>(
pmt::to_complex(msg));
440 std::vector< signed char >
515 std::vector< std::complex<float> >
618 template <
typename T>
672 template<
typename T,
typename Tto>
702 const char* functionbase,
703 void (T::*
function)(Tto),
705 const char* units_ =
"",
706 const char* desc_ =
"",
715 d_minpriv = minpriv_;
716 d_display = display_;
718 #ifdef GR_RPCSERVER_ENABLED
721 minpriv_, std::string(units_),
722 display_, std::string(desc_), min, max, def);
723 std::ostringstream oss(std::ostringstream::out);
724 oss << block_alias <<
"::" << functionbase;
755 const char* functionbase,
757 void (T::*
function)(Tto),
759 const char* units_ =
"",
760 const char* desc_ =
"",
769 d_minpriv = minpriv_;
770 d_display = display_;
772 #ifdef GR_RPCSERVER_ENABLED
775 minpriv_, std::string(units_),
776 display_, std::string(desc_), min, max, def);
777 std::ostringstream oss(std::ostringstream::out);
778 oss << name <<
"::" << functionbase;
787 #ifdef GR_RPCSERVER_ENABLED
796 std::string
units()
const {
return d_units; }
804 void units(std::string u) { d_units = u; }
812 std::string d_units, d_desc;
868 const char* functionbase,
869 void (T::*
function)(),
870 const char* desc_ =
"",
874 d_minpriv = minpriv_;
876 #ifdef GR_RPCSERVER_ENABLED
879 minpriv_, std::string(desc_));
880 std::ostringstream oss(std::ostringstream::out);
881 oss << block_alias <<
"::" << functionbase;
907 const char* functionbase,
909 void (T::*
function)(),
910 const char* desc_ =
"",
914 d_minpriv = minpriv_;
916 #ifdef GR_RPCSERVER_ENABLED
919 minpriv_, std::string(desc_));
920 std::ostringstream oss(std::ostringstream::out);
921 oss << name <<
"::" << functionbase;
930 #ifdef GR_RPCSERVER_ENABLED
986 template<
typename T,
typename Tfrom>
1018 const char* functionbase,
1019 Tfrom (T::*
function)(),
1021 const char* units_ =
"",
1022 const char* desc_ =
"",
1031 d_minpriv = minpriv_;
1032 d_display = display_;
1034 #ifdef GR_RPCSERVER_ENABLED
1037 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1038 std::ostringstream oss(std::ostringstream::out);
1039 oss << block_alias <<
"::" << functionbase;
1052 const char* functionbase,
1053 Tfrom (T::*
function)()
const,
1055 const char* units_ =
"",
1056 const char* desc_ =
"",
1065 d_minpriv = minpriv_;
1066 d_display = display_;
1068 #ifdef GR_RPCSERVER_ENABLED
1071 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1072 std::ostringstream oss(std::ostringstream::out);
1073 oss << block_alias <<
"::" << functionbase;
1105 const char* functionbase,
1107 Tfrom (T::*
function)(),
1109 const char* units_ =
"",
1110 const char* desc_ =
"",
1119 d_minpriv = minpriv_;
1120 d_display = display_;
1122 #ifdef GR_RPCSERVER_ENABLED
1125 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1126 std::ostringstream oss(std::ostringstream::out);
1127 oss << name <<
"::" << functionbase;
1140 const char* functionbase,
1142 Tfrom (T::*
function)()
const,
1144 const char* units_ =
"",
1145 const char* desc_ =
"",
1154 d_minpriv = minpriv_;
1155 d_display = display_;
1157 #ifdef GR_RPCSERVER_ENABLED
1160 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1161 std::ostringstream oss(std::ostringstream::out);
1162 oss << name <<
"::" << functionbase;
1171 #ifdef GR_RPCSERVER_ENABLED
1179 std::string
units()
const {
return d_units; }
1187 void units(std::string u) { d_units = u; }
1195 std::string d_units, d_desc;
1240 template<
typename Tfrom>
1265 throw std::runtime_error(
"ERROR: rpcbasic_register_variable called with no args. If this happens, someone has tried to use rpcbasic_register_variable incorrectly.");
1287 const char* functionbase,
1290 const char* units_ =
"",
1291 const char* desc_ =
"",
1295 min, max, def, units_, desc_, minpriv_, display_),
1296 d_variable(variable)
1338 template<
typename Tfrom>
1350 d_rpc_regset(
"FAIL",
"FAIL", this,
1355 throw std::runtime_error(
"ERROR: rpcbasic_register_variable_rw called with no args. if this happens someone used rpcbasic_register_variable_rw incorrectly.\n");
1382 const std::string& namebase,
1383 const char* functionbase,
1386 const char* units_ =
"",
1387 const char* desc_ =
"",
1391 min, max, def, units_, desc_),
1392 d_rpc_regset(namebase, functionbase, this,
1394 min, max, def, units_, desc_, minpriv, display_)
1405 template<
typename T>
1427 const char* handler,
1428 const char* units_ =
"",
1429 const char* desc_ =
"",
1435 d_minpriv = minpriv_;
1436 d_display = display_;
1438 #ifdef GR_RPCSERVER_ENABLED
1441 minpriv_, std::string(units_), display_, std::string(desc_),
1443 std::ostringstream oss(std::ostringstream::out);
1444 oss << block_alias <<
"::" << handler;
1453 #ifdef GR_RPCSERVER_ENABLED
1458 std::string
units()
const {
return d_units; }
1463 void units(std::string u) { d_units = u; }
1470 std::string d_units, d_desc;
Definition: rpcregisterhelpers.h:628
virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback)=0
rpcbasic_register_get< rpcbasic_register_variable< Tfrom >, Tfrom > d_rpc_reg
Definition: rpcregisterhelpers.h:1245
Definition: rpccallbackregister_base.h:80
~rpcbasic_register_trigger()
Definition: rpcregisterhelpers.h:928
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:513
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:415
Tfrom get()
Definition: rpcregisterhelpers.h:1247
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:162
rpcbasic_inserter(T *source, std::complex< double >(T::*func)())
Definition: rpcregisterhelpers.h:603
T * _source
Definition: rpcregisterhelpers.h:169
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:1139
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)())
Definition: rpcregisterhelpers.h:434
PMT_API pmt_t init_s32vector(size_t k, const int32_t *data)
Templated parent class for registering a ControlPort Extractor.
Definition: rpcregisterhelpers.h:178
rpcbasic_register_variable()
Definition: rpcregisterhelpers.h:1259
std::string units() const
Definition: rpcregisterhelpers.h:796
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:538
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:795
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1465
void set(Tfrom _variable)
Definition: rpcregisterhelpers.h:1358
PMT_API std::complex< double > to_complex(pmt_t z)
rpcbasic_inserter(T *source, std::vector< int >(T::*func)())
Definition: rpcregisterhelpers.h:484
T * _source
Definition: rpcregisterhelpers.h:116
rpcbasic_register_variable_rw()
Definition: rpcregisterhelpers.h:1349
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:113
std::string units() const
Definition: rpcregisterhelpers.h:1458
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:701
rpcbasic_inserter(T *source, std::vector< short >(T::*func)() const)
Definition: rpcregisterhelpers.h:455
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:580
Tfrom * d_variable
Definition: rpcregisterhelpers.h:1246
void units(std::string u)
Definition: rpcregisterhelpers.h:1463
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1461
Registers a read/write function to get and set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1339
Base class for registering a ControlPort Handler. Acts as a message acceptor.
Definition: rpcregisterhelpers.h:156
rpcbasic_handler(T *source, const char *handler)
Definition: rpcregisterhelpers.h:181
Base class for registering a ControlPort function.
Definition: rpcregisterhelpers.h:619
rpcbasic_inserter(T *source, std::vector< short >(T::*func)())
Definition: rpcregisterhelpers.h:459
std::string description() const
Definition: rpcregisterhelpers.h:1459
PMT_API pmt_t init_s8vector(size_t k, const int8_t *data)
void description(std::string d)
Definition: rpcregisterhelpers.h:939
Virtual base class that produces messages.
Definition: msg_producer.h:35
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:584
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)())
Definition: rpcregisterhelpers.h:557
std::string description() const
Definition: rpcregisterhelpers.h:797
priv_lvl_t
Definition: rpccallbackregister_base.h:46
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:807
Registers a message handler function to post a message to a block's handler.
Definition: rpcregisterhelpers.h:1406
void description(std::string d)
Definition: rpcregisterhelpers.h:1464
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1189
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:794
void units(std::string u)
Definition: rpcregisterhelpers.h:1187
Base class for registering a ControlPort Inserter. Produces a message.
Definition: rpcregisterhelpers.h:107
PMT_API pmt_t intern(const std::string &s)
Alias for pmt_string_to_symbol.
virtual void unregisterConfigureCallback(const std::string &id)=0
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:438
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:561
PMT_API const std::string symbol_to_string(const pmt_t &sym)
static int count
Definition: rpcregisterhelpers.h:622
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1185
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:411
Definition: rpccallbackregister_base.h:48
Tfrom(T::* _func)()
Definition: rpcregisterhelpers.h:117
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:138
Registers a 'get' function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:987
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:806
Templated parent class for registering a ControlPort Inserter.
Definition: rpcregisterhelpers.h:126
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:488
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:1381
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:754
virtual ~rpcbasic_base()
Definition: rpcregisterhelpers.h:632
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:1426
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1186
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1181
rpchandler_base(T *source, const char *handler)
Definition: rpcregisterhelpers.h:160
std::string description() const
Definition: rpcregisterhelpers.h:936
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1460
virtual void unregisterQueryCallback(const std::string &id)=0
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:937
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:1286
rpcinserter_base(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:110
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:1104
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:1017
Virtual base class that accepts messages.
Definition: messages/msg_accepter.h:35
rpcbasic_inserter(T *source, uint64_t(T::*func)() const)
Definition: rpcregisterhelpers.h:407
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1466
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:802
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:1251
virtual void unregisterHandlerCallback(const std::string &id)=0
static rpcserver_booter_base * get()
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:1177
#define PMT_NIL
Definition: pmt.h:103
rpcbasic_inserter(T *source, std::vector< float >(T::*func)())
Definition: rpcregisterhelpers.h:534
~rpcbasic_register_get()
Definition: rpcregisterhelpers.h:1169
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:1176
rpcbasic_inserter(T *source, std::vector< int >(T::*func)() const)
Definition: rpcregisterhelpers.h:480
Registers a 'trigger' function to trigger an action over ControlPort.
Definition: rpcregisterhelpers.h:844
Registers a read-only function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1241
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:798
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:530
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:803
PMT_API pmt_t init_f32vector(size_t k, const float *data)
DisplayType default_display() const
Definition: rpcregisterhelpers.h:799
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:1178
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:553
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:793
const char * _handler
Definition: rpcregisterhelpers.h:170
virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)=0
rpcinserter_base()
Definition: rpcregisterhelpers.h:111
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:607
PMT_API pmt_t init_c32vector(size_t k, const std::complex< float > *data)
std::string units() const
Definition: rpcregisterhelpers.h:1179
GR_RUNTIME_API gr::block_registry global_block_registry
rpcbasic_inserter(T *source, std::complex< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:576
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:1051
rpcbasic_inserter(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:134
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:801
rpcbasic_base()
Definition: rpcregisterhelpers.h:631
std::string description() const
Definition: rpcregisterhelpers.h:1180
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:906
void units(std::string u)
Definition: rpcregisterhelpers.h:804
~rpcbasic_register_set()
Definition: rpcregisterhelpers.h:785
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1190
rpcbasic_inserter(T *source, std::complex< double >(T::*func)() const)
Definition: rpcregisterhelpers.h:599
void description(std::string d)
Definition: rpcregisterhelpers.h:805
boost::intrusive_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:56
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1184
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:867
rpc_register_base()
Definition: rpcregisterhelpers.h:621
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)() const)
Definition: rpcregisterhelpers.h:505
~rpcbasic_register_handler()
Definition: rpcregisterhelpers.h:1451
PMT_API pmt_t init_s16vector(size_t k, const int16_t *data)
rpcbasic_inserter(T *source, Tfrom(T::*func)() const)
Definition: rpcregisterhelpers.h:130
void post(pmt::pmt_t which_port, pmt::pmt_t msg)
send msg to msg_accepter on port which_port
Definition: rpcregisterhelpers.h:164
basic_block_sptr block_lookup(pmt::pmt_t symbol)
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)() const)
Definition: rpcregisterhelpers.h:430
void description(std::string d)
Definition: rpcregisterhelpers.h:1188
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:463
static pmt_t mp(const std::string &s)
Make pmt symbol.
Definition: pmt_sugar.h:36
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:940
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1182
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)())
Definition: rpcregisterhelpers.h:509
uint32_t DisplayType
Definition: rpccallbackregister_base.h:29
Registers a 'set' function to set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:673