GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
rpcbasic_register_trigger< T > Struct Template Reference

Registers a 'trigger' function to trigger an action over ControlPort. More...

#include <gnuradio/rpcregisterhelpers.h>

Public Member Functions

 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. More...
 
 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. More...
 
 ~rpcbasic_register_trigger ()
 
std::string description () const
 
priv_lvl_t privilege_level () const
 
void description (std::string d)
 
void privilege_level (priv_lvl_t p)
 
- Public Member Functions inherited from rpcbasic_base
 rpcbasic_base ()
 
virtual ~rpcbasic_base ()
 

Detailed Description

template<typename T>
struct rpcbasic_register_trigger< T >

Registers a 'trigger' function to trigger an action over ControlPort.

This class allows us to set up triggered events or function calls over ControlPort. When used from a ControlPort client, the function established here will be activated. Generally, this is meant to enable some kind of trigger or action that a block or object will perform, such as a reset, start, stop, etc.

Simpler than the rpcbasic_register_set class, the constructor here only takes a few parameters, mostly because there is not actual variable associated with these function calls. It takes in the information to set up the pointer to the object that has the function, a ControlPort name (functionbase) for the triggered action, a description (desc_), and a privilege level (minpriv_).

Constructor & Destructor Documentation

template<typename T >
rpcbasic_register_trigger< T >::rpcbasic_register_trigger ( const std::string &  block_alias,
const char *  functionbase,
void(T::*)()  function,
const char *  desc_ = "",
priv_lvl_t  minpriv_ = RPC_PRIVLVL_MIN 
)
inline

Adds the ability to trigger a function over ControlPort.

This constructor is specifically for gr::block's to use to add trigger functions 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_aliasBlock's alias; use alias() to get it from the block.
functionbaseThe name of the function that we'll access over ControlPort
functionA function pointer to the real function accessed when called something like: &[block class]::set_[variable]
desc_A string to describing the variable.
minpriv_The required minimum privilege level

References gr::block_registry::block_lookup(), rpcmanager::get(), global_block_registry, rpcserver_booter_base::i(), pmt::intern(), and rpcserver_base::registerConfigureCallback().

template<typename T >
rpcbasic_register_trigger< T >::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 
)
inline

Adds the ability to trigger a function 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
nameName of the object being set up for ControlPort access
functionbaseThe name of the function that we'll access over ControlPort
objA pointer to the object itself
functionA function pointer to the real function accessed when called something like: &[block class]::set_[variable]
desc_A string to describing the variable.
minpriv_The required minimum privilege level

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

Member Function Documentation

template<typename T >
std::string rpcbasic_register_trigger< T >::description ( ) const
inline
template<typename T >
void rpcbasic_register_trigger< T >::description ( std::string  d)
inline
template<typename T >
priv_lvl_t rpcbasic_register_trigger< T >::privilege_level ( ) const
inline
template<typename T >
void rpcbasic_register_trigger< T >::privilege_level ( priv_lvl_t  p)
inline

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