GNU Radio Manual and C++ API Reference  3.7.13.4
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 
46 enum priv_lvl_t {
50 };
51 
52 enum KnobType {
58 };
59 
61 {
63  {
64  public:
65  callback_base_t(const priv_lvl_t priv_, const std::string& units_,
66  const DisplayType display_, const std::string& desc_,
67  const pmt::pmt_t min_, const pmt::pmt_t max_, const pmt::pmt_t def)
68  : priv(priv_), units(units_), description(desc_),
69  min(min_), max(max_), defaultvalue(def), display(display_)
70  {
71  }
72 
74  std::string units, description;
77  };
78 
79  template<typename T, typename Tsptr>
80  class callback_t : public callback_base_t
81  {
82  public:
83  callback_t(T* callback_, priv_lvl_t priv_,
84  const std::string& units_, const DisplayType display_, const:: std::string& desc_,
85  const pmt::pmt_t& min_, const pmt::pmt_t& max_, const pmt::pmt_t& def_) :
86  callback_base_t(priv_, units_, display_, desc_, min_, max_, def_),
87  callback(callback_)
88  {
89  }
90 
91  callback_t(T* callback_, priv_lvl_t priv_, const:: std::string& desc_) :
92  callback_base_t(priv_, "", 0, desc_, pmt::pmt_t(), pmt::pmt_t(), pmt::pmt_t()),
93  callback(callback_)
94  {
95  }
96 
97  Tsptr callback;
98  };
99 
103 
106 
107  virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback) = 0;
108  virtual void unregisterConfigureCallback(const std::string &id) = 0;
109  virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0;
110  virtual void unregisterQueryCallback(const std::string &id) = 0;
111  virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback) = 0;
112  virtual void unregisterHandlerCallback(const std::string &id) = 0;
113 };
114 
115 #endif /* RPCCALLBACKREGISTER_BASE_H */
Definition: rpccallbackregister_base.h:80
const uint32_t DISPTIME
Definition: rpccallbackregister_base.h:33
callbackregister_base()
Definition: rpccallbackregister_base.h:104
Definition: rpccallbackregister_base.h:54
Definition: rpccallbackregister_base.h:56
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:60
priv_lvl_t
Definition: rpccallbackregister_base.h:46
callback_t(T *callback_, priv_lvl_t priv_, const ::std::string &desc_)
Definition: rpccallbackregister_base.h:91
const uint32_t DISPOPTSCATTER
Definition: rpccallbackregister_base.h:44
Definition: rpccallbackregister_base.h:56
Definition: rpccallbackregister_base.h:56
Definition: rpccallbackregister_base.h:54
callback_t< gr::messages::msg_accepter, gr::messages::msg_accepter_sptr > configureCallback_t
Definition: rpccallbackregister_base.h:100
virtual void unregisterHandlerCallback(const std::string &id)=0
virtual ~callbackregister_base()
Definition: rpccallbackregister_base.h:105
Definition: rpccallbackregister_base.h:48
const uint32_t DISPXY
Definition: rpccallbackregister_base.h:34
pmt::pmt_t min
Definition: rpccallbackregister_base.h:75
Definition: rpccallbackregister_base.h:49
Definition: rpccallbackregister_base.h:47
Definition: rpccallbackregister_base.h:53
Definition: rpccallbackregister_base.h:53
Definition: rpccallbackregister_base.h:57
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:102
virtual void unregisterQueryCallback(const std::string &id)=0
KnobType
Definition: rpccallbackregister_base.h:52
Definition: rpccallbackregister_base.h:55
Definition: rpccallbackregister_base.h:53
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:53
const uint32_t DISPOPTSTEM
Definition: rpccallbackregister_base.h:42
pmt::pmt_t defaultvalue
Definition: rpccallbackregister_base.h:75
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:57
callback_t< gr::messages::msg_producer, gr::messages::msg_producer_sptr > queryCallback_t
Definition: rpccallbackregister_base.h:101
priv_lvl_t priv
Definition: rpccallbackregister_base.h:73
std::string units
Definition: rpccallbackregister_base.h:74
const uint32_t DISPPSD
Definition: rpccallbackregister_base.h:35
Definition: rpccallbackregister_base.h:54
std::string description
Definition: rpccallbackregister_base.h:74
Definition: rpccallbackregister_base.h:62
Definition: rpccallbackregister_base.h:54
DisplayType display
Definition: rpccallbackregister_base.h:76
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
pmt::pmt_t max
Definition: rpccallbackregister_base.h:75
Definition: pmt.h:51
Definition: rpccallbackregister_base.h:56
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:83
Tsptr callback
Definition: rpccallbackregister_base.h:97
Definition: rpccallbackregister_base.h:55
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:65