GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
rpccallbackregister_base.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef RPCCALLBACKREGISTER_BASE_H
12 #define RPCCALLBACKREGISTER_BASE_H
13 
16 
17 typedef uint32_t DisplayType;
18 
19 //! DisplayType Plotting types
20 constexpr uint32_t DISPNULL = 0x0000;
21 constexpr uint32_t DISPTIME = 0x0001;
22 constexpr uint32_t DISPXY = 0x0002;
23 constexpr uint32_t DISPPSD = 0x0004;
24 constexpr uint32_t DISPSPEC = 0x0008;
25 constexpr uint32_t DISPRAST = 0x0010;
26 
27 //! DisplayType Options
28 constexpr uint32_t DISPOPTCPLX = 0x0100;
29 constexpr uint32_t DISPOPTLOG = 0x0200;
30 constexpr uint32_t DISPOPTSTEM = 0x0400;
31 constexpr uint32_t DISPOPTSTRIP = 0x0800;
32 constexpr uint32_t DISPOPTSCATTER = 0x1000;
33 
35 
36 enum KnobType {
53 };
54 
56  struct callback_base_t {
57  public:
59  const std::string& units_,
60  const DisplayType display_,
61  const std::string& desc_,
62  const pmt::pmt_t min_,
63  const pmt::pmt_t max_,
64  const pmt::pmt_t def)
65  : priv(priv_),
66  units(units_),
67  description(desc_),
68  min(min_),
69  max(max_),
70  defaultvalue(def),
71  display(display_)
72  {
73  }
74 
76  std::string units, description;
79  };
80 
81  template <typename T, typename Tsptr>
82  class callback_t : public callback_base_t
83  {
84  public:
85  callback_t(T* callback_,
86  priv_lvl_t priv_,
87  const std::string& units_,
88  const DisplayType display_,
89  const ::std::string& desc_,
90  const pmt::pmt_t& min_,
91  const pmt::pmt_t& max_,
92  const pmt::pmt_t& def_)
93  : callback_base_t(priv_, units_, display_, desc_, min_, max_, def_),
94  callback(callback_)
95  {
96  }
97 
98  callback_t(T* callback_, priv_lvl_t priv_, const ::std::string& desc_)
100  priv_, "", 0, desc_, pmt::pmt_t(), pmt::pmt_t(), pmt::pmt_t()),
101  callback(callback_)
102  {
103  }
104 
105  Tsptr callback;
106  };
107 
114 
116  virtual ~callbackregister_base() { ; }
117 
118  virtual void registerConfigureCallback(const std::string& id,
119  const configureCallback_t callback) = 0;
120  virtual void unregisterConfigureCallback(const std::string& id) = 0;
121  virtual void registerQueryCallback(const std::string& id,
122  const queryCallback_t callback) = 0;
123  virtual void unregisterQueryCallback(const std::string& id) = 0;
124  virtual void registerHandlerCallback(const std::string& id,
125  const handlerCallback_t callback) = 0;
126  virtual void unregisterHandlerCallback(const std::string& id) = 0;
127 };
128 
129 #endif /* RPCCALLBACKREGISTER_BASE_H */
Definition: rpccallbackregister_base.h:83
Tsptr callback
Definition: rpccallbackregister_base.h:105
callback_t(T *callback_, priv_lvl_t priv_, const ::std::string &desc_)
Definition: rpccallbackregister_base.h:98
callback_t(T *callback_, priv_lvl_t priv_, const std::string &units_, const DisplayType display_, const ::std::string &desc_, const pmt::pmt_t &min_, const pmt::pmt_t &max_, const pmt::pmt_t &def_)
Definition: rpccallbackregister_base.h:85
Definition: pmt.h:38
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
constexpr uint32_t DISPNULL
DisplayType Plotting types.
Definition: rpccallbackregister_base.h:20
constexpr uint32_t DISPOPTSTRIP
Definition: rpccallbackregister_base.h:31
constexpr uint32_t DISPTIME
Definition: rpccallbackregister_base.h:21
constexpr uint32_t DISPXY
Definition: rpccallbackregister_base.h:22
priv_lvl_t
Definition: rpccallbackregister_base.h:34
@ RPC_PRIVLVL_NONE
Definition: rpccallbackregister_base.h:34
@ RPC_PRIVLVL_ALL
Definition: rpccallbackregister_base.h:34
@ RPC_PRIVLVL_MIN
Definition: rpccallbackregister_base.h:34
constexpr uint32_t DISPOPTSCATTER
Definition: rpccallbackregister_base.h:32
KnobType
Definition: rpccallbackregister_base.h:36
@ KNOBSTRING
Definition: rpccallbackregister_base.h:42
@ KNOBVECINT
Definition: rpccallbackregister_base.h:48
@ KNOBVECSTRING
Definition: rpccallbackregister_base.h:51
@ KNOBLONG
Definition: rpccallbackregister_base.h:43
@ KNOBCHAR
Definition: rpccallbackregister_base.h:38
@ KNOBVECBOOL
Definition: rpccallbackregister_base.h:44
@ KNOBVECFLOAT
Definition: rpccallbackregister_base.h:49
@ KNOBCOMPLEX
Definition: rpccallbackregister_base.h:45
@ KNOBFLOAT
Definition: rpccallbackregister_base.h:40
@ KNOBDOUBLE
Definition: rpccallbackregister_base.h:41
@ KNOBVECCHAR
Definition: rpccallbackregister_base.h:47
@ KNOBVECDOUBLE
Definition: rpccallbackregister_base.h:50
@ KNOBBOOL
Definition: rpccallbackregister_base.h:37
@ KNOBCOMPLEXD
Definition: rpccallbackregister_base.h:46
@ KNOBVECLONG
Definition: rpccallbackregister_base.h:52
@ KNOBINT
Definition: rpccallbackregister_base.h:39
constexpr uint32_t DISPOPTSTEM
Definition: rpccallbackregister_base.h:30
constexpr uint32_t DISPOPTLOG
Definition: rpccallbackregister_base.h:29
constexpr uint32_t DISPOPTCPLX
DisplayType Options.
Definition: rpccallbackregister_base.h:28
constexpr uint32_t DISPPSD
Definition: rpccallbackregister_base.h:23
uint32_t DisplayType
Definition: rpccallbackregister_base.h:17
constexpr uint32_t DISPSPEC
Definition: rpccallbackregister_base.h:24
constexpr uint32_t DISPRAST
Definition: rpccallbackregister_base.h:25
Definition: rpccallbackregister_base.h:56
pmt::pmt_t min
Definition: rpccallbackregister_base.h:77
callback_base_t(const priv_lvl_t priv_, const std::string &units_, const DisplayType display_, const std::string &desc_, const pmt::pmt_t min_, const pmt::pmt_t max_, const pmt::pmt_t def)
Definition: rpccallbackregister_base.h:58
std::string description
Definition: rpccallbackregister_base.h:76
pmt::pmt_t defaultvalue
Definition: rpccallbackregister_base.h:77
std::string units
Definition: rpccallbackregister_base.h:76
DisplayType display
Definition: rpccallbackregister_base.h:78
priv_lvl_t priv
Definition: rpccallbackregister_base.h:75
pmt::pmt_t max
Definition: rpccallbackregister_base.h:77
Definition: rpccallbackregister_base.h:55
virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)=0
callback_t< gr::messages::msg_producer, gr::messages::msg_producer_sptr > queryCallback_t
Definition: rpccallbackregister_base.h:111
callbackregister_base()
Definition: rpccallbackregister_base.h:115
virtual void unregisterConfigureCallback(const std::string &id)=0
virtual ~callbackregister_base()
Definition: rpccallbackregister_base.h:116
virtual void unregisterQueryCallback(const std::string &id)=0
callback_t< gr::messages::msg_accepter, gr::messages::msg_accepter_sptr > handlerCallback_t
Definition: rpccallbackregister_base.h:113
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
callback_t< gr::messages::msg_accepter, gr::messages::msg_accepter_sptr > configureCallback_t
Definition: rpccallbackregister_base.h:109
virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback)=0
virtual void unregisterHandlerCallback(const std::string &id)=0