GNU Radio C++ API Reference: rpcbasic_register_get< T, Tfrom > Class Template Reference

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
rpcbasic_register_get< T, Tfrom > Class Template Reference

Registers a 'get' function to get a parameter over ControlPort. More...

`#include <gnuradio/rpcregisterhelpers.h>`

## Public Member Functions
| 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.
| 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 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)
| Adds the ability to get the variable over ControlPort.
| 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.
| ~rpcbasic_register_get () override
pmt::pmt_t | min () const
pmt::pmt_t | max () const
pmt::pmt_t | def () const
std::string | units () const
std::string | description () const
priv_lvl_t | privilege_level () const
DisplayType | default_display () const
void | set_min (pmt::pmt_t p)
void | set_max (pmt::pmt_t p)
void | set_def (pmt::pmt_t p)
void | units (std::string u)
void | description (std::string d)
void | privilege_level (priv_lvl_t p)
void | default_display (DisplayType d)
Public Member Functions inherited from rpcbasic_base
| rpcbasic_base ()
virtual | ~rpcbasic_base ()

## Detailed Description

template<typename T, typename Tfrom>
class rpcbasic_register_get< T, Tfrom >

Registers a 'get' function to get a parameter over ControlPort.

This class allows us to remotely get a value or parameter of the block over ControlPort. The get occurs by calling a getter accessor function of the class, usually [variable](), which is passed in as `function`.

We can set the (expected) minimum (`min`), maximum (`max`), and default (`def`) of the variables we will get. These values are not enforced, however, but can be useful for setting up graphs and other ways of bounding the data.

This class also allows us to provide information to the user about the variable, such as an appropriate unit (`units_`) as well as a description (`desc_`) about what the variable does.

The privilege (`minpriv_`) level is the minimum privilege level a remote must identify with to be able to call this function.

We also provide display hints (`display_`), which can be used by the ControlPort client application to know how to best display or even print the data. This is a mask of options for variables set in rpccallbackregister_base.h. The mask is defined by one of the "DisplayType Plotting Types" and or'd with any of the "DisplayType Options" features. See "Display Options" in ControlPort for details.

## Constructor & Destructor Documentation

## ◆ rpcbasic_register_get() [1/4]

template<typename T, typename Tfrom>

rpcbasic_register_get< T, Tfrom >::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 )
| inline

Adds the ability to get the variable over ControlPort.

This constructor is specifically for gr::block's to use to add gettable variables to ControlPort. Generally meant to be used in gr::block::setup_rpc.

Uses the block's alias to create the ControlPort interface. This alias is cross-referenced by the global_block_registry (static variable of type gr::block_registry) to get the pointer to the block.

Parameters

  block_alias | Block's alias; use alias() to get it from the block.
  functionbase | The name of the function that we'll access over ControlPort
  function | A function pointer to the real function accessed when called something like: &[block class]::[variable]()
  min | Expected minimum value the parameter can hold
  max | Expected maximum value the parameter can hold
  def | Expected default value the parameter can hold
  units_ | A string to describe what units to represent the variable with
  desc_ | A string to describing the variable.
  minpriv_ | The required minimum privilege level
  display_ | The display mask

References gr::block_registry::block_lookup(), def(), DISPNULL, rpcmanager::get(), global_block_registry, rpcserver_booter_base::i(), pmt::intern(), max(), min(), rpcserver_base::registerQueryCallback(), and RPC_PRIVLVL_MIN.

## ◆ rpcbasic_register_get() [2/4]

template<typename T, typename Tfrom>

rpcbasic_register_get< T, Tfrom >::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 )
| inline

Same as rpcbasic_register_get::rpcbasic_register_get that allows using '[variable]() const' getter functions.

References gr::block_registry::block_lookup(), def(), DISPNULL, rpcmanager::get(), global_block_registry, rpcserver_booter_base::i(), pmt::intern(), max(), min(), rpcserver_base::registerQueryCallback(), and RPC_PRIVLVL_MIN.

## ◆ rpcbasic_register_get() [3/4]

template<typename T, typename Tfrom>

rpcbasic_register_get< T, Tfrom >::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 )
| inline

Adds the ability to get the variable over ControlPort.

Allows us to add non gr::block related objects to ControlPort. Instead of using the block's alias, we give it a `name` and the actual pointer to the object as `obj`. We just need to make sure that the pointer to this object is always valid.

Parameters

  name | Name of the object being set up for ControlPort access
  functionbase | The name of the function that we'll access over ControlPort
  obj | A pointer to the object itself
  function | A function pointer to the real function accessed when called something like: &[block class]::set_[variable]()
  min | Expected minimum value the parameter can hold
  max | Expected maximum value the parameter can hold
  def | Expected default value the parameter can hold
  units_ | A string to describe what units to represent the variable with
  desc_ | A string to describing the variable.
  minpriv_ | The required minimum privilege level
  display_ | The display mask

References def(), DISPNULL, rpcmanager::get(), rpcserver_booter_base::i(), max(), min(), rpcserver_base::registerQueryCallback(), and RPC_PRIVLVL_MIN.

## ◆ rpcbasic_register_get() [4/4]

template<typename T, typename Tfrom>

rpcbasic_register_get< T, Tfrom >::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 )
| inline

Same as above that allows using '[variable]() const' getter functions.

References def(), DISPNULL, rpcmanager::get(), rpcserver_booter_base::i(), max(), min(), rpcserver_base::registerQueryCallback(), and RPC_PRIVLVL_MIN.

## ◆ ~rpcbasic_register_get()

template<typename T, typename Tfrom>

rpcbasic_register_get< T, Tfrom >::~rpcbasic_register_get | ( |  | ) |
| inlineoverride

References rpcmanager::get(), rpcserver_booter_base::i(), and rpcserver_base::unregisterQueryCallback().

## Member Function Documentation

## ◆ def()

template<typename T, typename Tfrom>

pmt::pmt_t rpcbasic_register_get< T, Tfrom >::def | ( |  | ) | const
| inline

Referenced by rpcbasic_register_get(), rpcbasic_register_get(), rpcbasic_register_get(), and rpcbasic_register_get().

## ◆ default_display() [1/2]

template<typename T, typename Tfrom>

DisplayType rpcbasic_register_get< T, Tfrom >::default_display | ( |  | ) | const
| inline

## ◆ default_display() [2/2]

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::default_display | ( | DisplayType | d | ) |
| inline

## ◆ description() [1/2]

template<typename T, typename Tfrom>

std::string rpcbasic_register_get< T, Tfrom >::description | ( |  | ) | const
| inline

## ◆ description() [2/2]

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::description | ( | std::string | d | ) |
| inline

## ◆ max()

template<typename T, typename Tfrom>

pmt::pmt_t rpcbasic_register_get< T, Tfrom >::max | ( |  | ) | const
| inline

Referenced by rpcbasic_register_get(), rpcbasic_register_get(), rpcbasic_register_get(), and rpcbasic_register_get().

## ◆ min()

template<typename T, typename Tfrom>

pmt::pmt_t rpcbasic_register_get< T, Tfrom >::min | ( |  | ) | const
| inline

Referenced by rpcbasic_register_get(), rpcbasic_register_get(), rpcbasic_register_get(), and rpcbasic_register_get().

## ◆ privilege_level() [1/2]

template<typename T, typename Tfrom>

priv_lvl_t rpcbasic_register_get< T, Tfrom >::privilege_level | ( |  | ) | const
| inline

## ◆ privilege_level() [2/2]

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::privilege_level | ( | priv_lvl_t | p | ) |
| inline

## ◆ set_def()

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::set_def | ( | pmt::pmt_t | p | ) |
| inline

## ◆ set_max()

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::set_max | ( | pmt::pmt_t | p | ) |
| inline

## ◆ set_min()

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::set_min | ( | pmt::pmt_t | p | ) |
| inline

## ◆ units() [1/2]

template<typename T, typename Tfrom>

std::string rpcbasic_register_get< T, Tfrom >::units | ( |  | ) | const
| inline

## ◆ units() [2/2]

template<typename T, typename Tfrom>

void rpcbasic_register_get< T, Tfrom >::units | ( | std::string | u | ) |
| inline

The documentation for this class was generated from the following file:

- rpcregisterhelpers.h