GNU Radio 3.7.2.1-77 C++ API
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 
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  Tsptr callback;
92  };
93 
96 
98  virtual ~callbackregister_base() {;}
99 
100  virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback) = 0;
101  virtual void unregisterConfigureCallback(const std::string &id) = 0;
102  virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0;
103  virtual void unregisterQueryCallback(const std::string &id) = 0;
104 };
105 
106 #endif /* RPCCALLBACKREGISTER_BASE_H */