GNU Radio Manual and C++ API Reference  3.8.1.0
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef RPCCALLBACKREGISTER_BASE_H
24 #define RPCCALLBACKREGISTER_BASE_H
25 
28 
29 typedef uint32_t DisplayType;
30 
31 //! DisplayType Plotting types
32 const uint32_t DISPNULL = 0x0000;
33 const uint32_t DISPTIME = 0x0001;
34 const uint32_t DISPXY = 0x0002;
35 const uint32_t DISPPSD = 0x0004;
36 const uint32_t DISPSPEC = 0x0008;
37 const uint32_t DISPRAST = 0x0010;
38 
39 //! DisplayType Options
40 const uint32_t DISPOPTCPLX = 0x0100;
41 const uint32_t DISPOPTLOG = 0x0200;
42 const uint32_t DISPOPTSTEM = 0x0400;
43 const uint32_t DISPOPTSTRIP = 0x0800;
44 const uint32_t DISPOPTSCATTER = 0x1000;
45 
47 
48 enum KnobType {
65 };
66 
68  struct callback_base_t {
69  public:
71  const std::string& units_,
72  const DisplayType display_,
73  const std::string& desc_,
74  const pmt::pmt_t min_,
75  const pmt::pmt_t max_,
76  const pmt::pmt_t def)
77  : priv(priv_),
78  units(units_),
79  description(desc_),
80  min(min_),
81  max(max_),
82  defaultvalue(def),
83  display(display_)
84  {
85  }
86 
88  std::string units, description;
91  };
92 
93  template <typename T, typename Tsptr>
94  class callback_t : public callback_base_t
95  {
96  public:
97  callback_t(T* callback_,
98  priv_lvl_t priv_,
99  const std::string& units_,
100  const DisplayType display_,
101  const ::std::string& desc_,
102  const pmt::pmt_t& min_,
103  const pmt::pmt_t& max_,
104  const pmt::pmt_t& def_)
105  : callback_base_t(priv_, units_, display_, desc_, min_, max_, def_),
106  callback(callback_)
107  {
108  }
109 
110  callback_t(T* callback_, priv_lvl_t priv_, const ::std::string& desc_)
111  : callback_base_t(
112  priv_, "", 0, desc_, pmt::pmt_t(), pmt::pmt_t(), pmt::pmt_t()),
113  callback(callback_)
114  {
115  }
116 
117  Tsptr callback;
118  };
119 
126 
128  virtual ~callbackregister_base() { ; }
129 
130  virtual void registerConfigureCallback(const std::string& id,
131  const configureCallback_t callback) = 0;
132  virtual void unregisterConfigureCallback(const std::string& id) = 0;
133  virtual void registerQueryCallback(const std::string& id,
134  const queryCallback_t callback) = 0;
135  virtual void unregisterQueryCallback(const std::string& id) = 0;
136  virtual void registerHandlerCallback(const std::string& id,
137  const handlerCallback_t callback) = 0;
138  virtual void unregisterHandlerCallback(const std::string& id) = 0;
139 };
140 
141 #endif /* RPCCALLBACKREGISTER_BASE_H */
Definition: rpccallbackregister_base.h:94
const uint32_t DISPTIME
Definition: rpccallbackregister_base.h:33
callbackregister_base()
Definition: rpccallbackregister_base.h:127
Definition: rpccallbackregister_base.h:54
boost::shared_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:96
Definition: rpccallbackregister_base.h:59
const uint32_t DISPOPTLOG
Definition: rpccallbackregister_base.h:41
virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)=0
const uint32_t DISPRAST
Definition: rpccallbackregister_base.h:37
Definition: rpccallbackregister_base.h:67
priv_lvl_t
Definition: rpccallbackregister_base.h:46
callback_t(T *callback_, priv_lvl_t priv_, const ::std::string &desc_)
Definition: rpccallbackregister_base.h:110
const uint32_t DISPOPTSCATTER
Definition: rpccallbackregister_base.h:44
Definition: rpccallbackregister_base.h:60
Definition: rpccallbackregister_base.h:62
Definition: rpccallbackregister_base.h:53
callback_t< gr::messages::msg_accepter, gr::messages::msg_accepter_sptr > configureCallback_t
Definition: rpccallbackregister_base.h:121
virtual void unregisterHandlerCallback(const std::string &id)=0
virtual ~callbackregister_base()
Definition: rpccallbackregister_base.h:128
Definition: rpccallbackregister_base.h:46
const uint32_t DISPXY
Definition: rpccallbackregister_base.h:34
pmt::pmt_t min
Definition: rpccallbackregister_base.h:89
Definition: rpccallbackregister_base.h:46
Definition: rpccallbackregister_base.h:46
Definition: rpccallbackregister_base.h:50
Definition: rpccallbackregister_base.h:49
Definition: rpccallbackregister_base.h:63
const uint32_t DISPSPEC
Definition: rpccallbackregister_base.h:36
callback_t< gr::messages::msg_accepter, gr::messages::msg_accepter_sptr > handlerCallback_t
Definition: rpccallbackregister_base.h:125
virtual void unregisterQueryCallback(const std::string &id)=0
KnobType
Definition: rpccallbackregister_base.h:48
Definition: rpccallbackregister_base.h:58
Definition: rpccallbackregister_base.h:51
const uint32_t DISPOPTCPLX
DisplayType Options.
Definition: rpccallbackregister_base.h:40
virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback)=0
const uint32_t DISPNULL
DisplayType Plotting types.
Definition: rpccallbackregister_base.h:32
Definition: rpccallbackregister_base.h:52
const uint32_t DISPOPTSTEM
Definition: rpccallbackregister_base.h:42
pmt::pmt_t defaultvalue
Definition: rpccallbackregister_base.h:89
virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback)=0
virtual void unregisterConfigureCallback(const std::string &id)=0
const uint32_t DISPOPTSTRIP
Definition: rpccallbackregister_base.h:43
Definition: rpccallbackregister_base.h:64
callback_t< gr::messages::msg_producer, gr::messages::msg_producer_sptr > queryCallback_t
Definition: rpccallbackregister_base.h:123
priv_lvl_t priv
Definition: rpccallbackregister_base.h:87
std::string units
Definition: rpccallbackregister_base.h:88
const uint32_t DISPPSD
Definition: rpccallbackregister_base.h:35
Definition: rpccallbackregister_base.h:55
std::string description
Definition: rpccallbackregister_base.h:88
Definition: rpccallbackregister_base.h:68
Definition: rpccallbackregister_base.h:56
DisplayType display
Definition: rpccallbackregister_base.h:90
pmt::pmt_t max
Definition: rpccallbackregister_base.h:89
Definition: pmt.h:51
Definition: rpccallbackregister_base.h:61
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:97
Tsptr callback
Definition: rpccallbackregister_base.h:117
Definition: rpccallbackregister_base.h:57
uint32_t DisplayType
Definition: rpccallbackregister_base.h:29
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:70