23 #ifndef RPCREGISTERHELPERS_H
24 #define RPCREGISTERHELPERS_H
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>
308 std::complex<float> k =
static_cast<std::complex<float>
>(
pmt::to_complex(msg));
397 std::vector< signed char >
472 std::vector< std::complex<float> >
575 template <
typename T>
629 template<
typename T,
typename Tto>
659 const char* functionbase,
660 void (T::*
function)(Tto),
662 const char* units_ =
"",
663 const char* desc_ =
"",
672 d_minpriv = minpriv_;
673 d_display = display_;
675 #ifdef RPCSERVER_ENABLED
678 minpriv_, std::string(units_),
679 display_, std::string(desc_), min, max, def);
680 std::ostringstream oss(std::ostringstream::out);
681 oss << block_alias <<
"::" << functionbase;
712 const char* functionbase,
714 void (T::*
function)(Tto),
716 const char* units_ =
"",
717 const char* desc_ =
"",
726 d_minpriv = minpriv_;
727 d_display = display_;
729 #ifdef RPCSERVER_ENABLED
732 minpriv_, std::string(units_),
733 display_, std::string(desc_), min, max, def);
734 std::ostringstream oss(std::ostringstream::out);
735 oss << name <<
"::" << functionbase;
744 #ifdef RPCSERVER_ENABLED
753 std::string
units()
const {
return d_units; }
761 void units(std::string u) { d_units = u; }
769 std::string d_units, d_desc;
825 const char* functionbase,
826 void (T::*
function)(),
827 const char* desc_ =
"",
831 d_minpriv = minpriv_;
833 #ifdef RPCSERVER_ENABLED
836 minpriv_, std::string(desc_));
837 std::ostringstream oss(std::ostringstream::out);
838 oss << block_alias <<
"::" << functionbase;
864 const char* functionbase,
866 void (T::*
function)(),
867 const char* desc_ =
"",
871 d_minpriv = minpriv_;
873 #ifdef RPCSERVER_ENABLED
876 minpriv_, std::string(desc_));
877 std::ostringstream oss(std::ostringstream::out);
878 oss << name <<
"::" << functionbase;
887 #ifdef RPCSERVER_ENABLED
943 template<
typename T,
typename Tfrom>
975 const char* functionbase,
976 Tfrom (T::*
function)(),
978 const char* units_ =
"",
979 const char* desc_ =
"",
988 d_minpriv = minpriv_;
989 d_display = display_;
991 #ifdef RPCSERVER_ENABLED
994 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
995 std::ostringstream oss(std::ostringstream::out);
996 oss << block_alias <<
"::" << functionbase;
1009 const char* functionbase,
1010 Tfrom (T::*
function)()
const,
1012 const char* units_ =
"",
1013 const char* desc_ =
"",
1022 d_minpriv = minpriv_;
1023 d_display = display_;
1025 #ifdef RPCSERVER_ENABLED
1028 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1029 std::ostringstream oss(std::ostringstream::out);
1030 oss << block_alias <<
"::" << functionbase;
1062 const char* functionbase,
1064 Tfrom (T::*
function)(),
1066 const char* units_ =
"",
1067 const char* desc_ =
"",
1076 d_minpriv = minpriv_;
1077 d_display = display_;
1079 #ifdef RPCSERVER_ENABLED
1082 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1083 std::ostringstream oss(std::ostringstream::out);
1084 oss << name <<
"::" << functionbase;
1097 const char* functionbase,
1099 Tfrom (T::*
function)()
const,
1101 const char* units_ =
"",
1102 const char* desc_ =
"",
1111 d_minpriv = minpriv_;
1112 d_display = display_;
1114 #ifdef RPCSERVER_ENABLED
1117 minpriv_, std::string(units_), display_, std::string(desc_), min, max, def);
1118 std::ostringstream oss(std::ostringstream::out);
1119 oss << name <<
"::" << functionbase;
1128 #ifdef RPCSERVER_ENABLED
1136 std::string
units()
const {
return d_units; }
1144 void units(std::string u) { d_units = u; }
1152 std::string d_units, d_desc;
1197 template<
typename Tfrom>
1222 throw std::runtime_error(
"ERROR: rpcbasic_register_variable called with no args. If this happens, someone has tried to use rpcbasic_register_variable incorrectly.");
1244 const char* functionbase,
1247 const char* units_ =
"",
1248 const char* desc_ =
"",
1252 min, max, def, units_, desc_, minpriv_, display_),
1295 template<
typename Tfrom>
1307 d_rpc_regset(
"FAIL",
"FAIL", this,
1312 throw std::runtime_error(
"ERROR: rpcbasic_register_variable_rw called with no args. if this happens someone used rpcbasic_register_variable_rw incorrectly.\n");
1339 const std::string& namebase,
1340 const char* functionbase,
1343 const char* units_ =
"",
1344 const char* desc_ =
"",
1348 min, max, def, units_, desc_),
1349 d_rpc_regset(namebase, functionbase, this,
1351 min, max, def, units_, desc_, minpriv, display_)
Definition: rpcregisterhelpers.h:585
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:1202
Definition: rpccallbackregister_base.h:80
~rpcbasic_register_trigger()
Definition: rpcregisterhelpers.h:885
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:470
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:372
Tfrom get()
Definition: rpcregisterhelpers.h:1204
PMT_API pmt_t from_complex(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
rpcbasic_inserter(T *source, std::complex< double >(T::*func)())
Definition: rpcregisterhelpers.h:560
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:1096
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)())
Definition: rpcregisterhelpers.h:391
PMT_API pmt_t init_s32vector(size_t k, const int32_t *data)
rpcbasic_register_variable()
Definition: rpcregisterhelpers.h:1216
std::string units() const
Definition: rpcregisterhelpers.h:753
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:495
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:752
void set(Tfrom _variable)
Definition: rpcregisterhelpers.h:1315
PMT_API std::complex< double > to_complex(pmt_t z)
rpcbasic_inserter(T *source, std::vector< int >(T::*func)())
Definition: rpcregisterhelpers.h:441
T * _source
Definition: rpcregisterhelpers.h:116
rpcbasic_register_variable_rw()
Definition: rpcregisterhelpers.h:1306
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:113
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:658
rpcbasic_inserter(T *source, std::vector< short >(T::*func)() const)
Definition: rpcregisterhelpers.h:412
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:537
Tfrom * d_variable
Definition: rpcregisterhelpers.h:1203
Registers a read/write function to get and set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1296
Base class for registering a ControlPort function.
Definition: rpcregisterhelpers.h:576
rpcbasic_inserter(T *source, std::vector< short >(T::*func)())
Definition: rpcregisterhelpers.h:416
PMT_API pmt_t init_s8vector(size_t k, const int8_t *data)
void description(std::string d)
Definition: rpcregisterhelpers.h:896
Virtual base class that produces messages.
Definition: msg_producer.h:35
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:541
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)())
Definition: rpcregisterhelpers.h:514
std::string description() const
Definition: rpcregisterhelpers.h:754
priv_lvl_t
Definition: rpccallbackregister_base.h:46
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:764
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:1146
unsigned char uint8_t
Definition: stdint.h:78
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:751
void units(std::string u)
Definition: rpcregisterhelpers.h:1144
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:395
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:518
PMT_API const std::string symbol_to_string(const pmt_t &sym)
static int count
Definition: rpcregisterhelpers.h:579
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1142
PMT_API bool to_bool(pmt_t val)
Return true if val is pmt::True, return false when val is pmt::PMT_F,.
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
rpcbasic_inserter(T *source, uint64_t(T::*func)())
Definition: rpcregisterhelpers.h:368
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:944
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:763
Templated parent class for registering a ControlPort Inserter.
Definition: rpcregisterhelpers.h:126
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:445
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:1338
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:711
virtual ~rpcbasic_base()
Definition: rpcregisterhelpers.h:589
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:1143
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:1138
std::string description() const
Definition: rpcregisterhelpers.h:893
virtual void unregisterQueryCallback(const std::string &id)=0
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:894
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:1243
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:1061
unsigned __int64 uint64_t
Definition: stdint.h:90
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:974
Virtual base class that accepts messages.
Definition: messages/msg_accepter.h:35
rpcbasic_inserter(T *source, uint64_t(T::*func)() const)
Definition: rpcregisterhelpers.h:364
void set_max(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:759
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:1208
static rpcserver_booter_base * get()
pmt::pmt_t max() const
Definition: rpcregisterhelpers.h:1134
#define PMT_NIL
Definition: pmt.h:252
rpcbasic_inserter(T *source, std::vector< float >(T::*func)())
Definition: rpcregisterhelpers.h:491
~rpcbasic_register_get()
Definition: rpcregisterhelpers.h:1126
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:1133
rpcbasic_inserter(T *source, std::vector< int >(T::*func)() const)
Definition: rpcregisterhelpers.h:437
Registers a 'trigger' function to trigger an action over ControlPort.
Definition: rpcregisterhelpers.h:801
Registers a read-only function to get a parameter over ControlPort.
Definition: rpcregisterhelpers.h:1198
priv_lvl_t privilege_level() const
Definition: rpcregisterhelpers.h:755
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:487
void set_def(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:760
PMT_API pmt_t init_f32vector(size_t k, const float *data)
VOLK_API void(kern.name) _manual($kern.arglist_full
Call into a specific implementation given by name.
DisplayType default_display() const
Definition: rpcregisterhelpers.h:756
pmt::pmt_t def() const
Definition: rpcregisterhelpers.h:1135
rpcbasic_inserter(T *source, std::vector< uint8_t >(T::*func)() const)
Definition: rpcregisterhelpers.h:510
pmt::pmt_t min() const
Definition: rpcregisterhelpers.h:750
rpcinserter_base()
Definition: rpcregisterhelpers.h:111
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:564
PMT_API pmt_t init_c32vector(size_t k, const std::complex< float > *data)
std::string units() const
Definition: rpcregisterhelpers.h:1136
VOLK_API $kern pname $kern name
A function pointer to the dispatcher implementation.
GR_RUNTIME_API gr::block_registry global_block_registry
rpcbasic_inserter(T *source, std::complex< float >(T::*func)() const)
Definition: rpcregisterhelpers.h:533
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:1008
rpcbasic_inserter(T *source, Tfrom(T::*func)())
Definition: rpcregisterhelpers.h:134
void set_min(pmt::pmt_t p)
Definition: rpcregisterhelpers.h:758
rpcbasic_base()
Definition: rpcregisterhelpers.h:588
std::string description() const
Definition: rpcregisterhelpers.h:1137
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:863
void units(std::string u)
Definition: rpcregisterhelpers.h:761
~rpcbasic_register_set()
Definition: rpcregisterhelpers.h:742
void default_display(DisplayType d)
Definition: rpcregisterhelpers.h:1147
rpcbasic_inserter(T *source, std::complex< double >(T::*func)() const)
Definition: rpcregisterhelpers.h:556
void description(std::string d)
Definition: rpcregisterhelpers.h:762
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:1141
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:824
rpc_register_base()
Definition: rpcregisterhelpers.h:578
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)() const)
Definition: rpcregisterhelpers.h:462
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
basic_block_sptr block_lookup(pmt::pmt_t symbol)
rpcbasic_inserter(T *source, std::vector< signed char >(T::*func)() const)
Definition: rpcregisterhelpers.h:387
void description(std::string d)
Definition: rpcregisterhelpers.h:1145
pmt::pmt_t retrieve()
send msg to msg_producer
Definition: rpcregisterhelpers.h:420
static pmt_t mp(const std::string &s)
Make pmt symbol.
Definition: pmt_sugar.h:36
unsigned char bool
Definition: stdbool.h:30
void privilege_level(priv_lvl_t p)
Definition: rpcregisterhelpers.h:897
DisplayType default_display() const
Definition: rpcregisterhelpers.h:1139
rpcbasic_inserter(T *source, std::vector< std::complex< float > >(T::*func)())
Definition: rpcregisterhelpers.h:466
uint32_t DisplayType
Definition: rpccallbackregister_base.h:29
Registers a 'set' function to set a parameter over ControlPort.
Definition: rpcregisterhelpers.h:630