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
rpcserver_aggregator.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 RPCSERVER_AGGREGATOR_H
24 #define RPCSERVER_AGGREGATOR_H
25 
26 #include <vector>
27 #include <string>
30 
31 class rpcserver_aggregator : public virtual rpcserver_base
32 {
33 public:
35  virtual ~rpcserver_aggregator();
36 
37  void registerConfigureCallback(const std::string &id, const configureCallback_t callback);
38  void unregisterConfigureCallback(const std::string &id);
39 
40  void registerQueryCallback(const std::string &id, const queryCallback_t callback);
41  void unregisterQueryCallback(const std::string &id);
42 
43  void registerHandlerCallback(const std::string &id, const handlerCallback_t callback);
44  void unregisterHandlerCallback(const std::string &id);
45 
46  void registerServer(rpcmanager_base::rpcserver_booter_base_sptr server);
47 
48  const std::string& type();
49 
50  const std::vector<std::string>& registeredServers();
51 
52 private:
53  template<class T, typename Tcallback>
54  struct registerConfigureCallback_f: public std::unary_function<T,void>
55  {
56  registerConfigureCallback_f(const std::string &_id, const Tcallback _callback)
57  : id(_id), callback(_callback)
58  {;}
59 
60  void operator()(T& x) { x->i()->registerConfigureCallback(id, callback); }
61  const std::string& id; const Tcallback& callback;
62  };
63 
64  template<class T, typename Tcallback>
65  struct unregisterConfigureCallback_f: public std::unary_function<T,void>
66  {
67  unregisterConfigureCallback_f(const std::string &_id)
68  : id(_id)
69  {;}
70 
71  void operator()(T& x) { x->i()->unregisterConfigureCallback(id); }
72  const std::string& id;
73  };
74 
75  template<class T, typename Tcallback>
76  struct registerQueryCallback_f: public std::unary_function<T,void>
77  {
78  registerQueryCallback_f(const std::string &_id, const Tcallback _callback)
79  : id(_id), callback(_callback)
80  {;}
81 
82  void operator()(T& x) { x->i()->registerQueryCallback(id, callback); }
83  const std::string& id; const Tcallback& callback;
84  };
85 
86  template<class T, typename Tcallback>
87  struct unregisterQueryCallback_f: public std::unary_function<T,void>
88  {
89  unregisterQueryCallback_f(const std::string &_id)
90  : id(_id)
91  {;}
92 
93  void operator()(T& x) { x->i()->unregisterQueryCallback(id); }
94  const std::string& id;
95  };
96 
97 
98 
99  template<class T, typename Tcallback>
100  struct registerHandlerCallback_f: public std::unary_function<T,void>
101  {
102  registerHandlerCallback_f(const std::string &_id, const Tcallback _callback)
103  : id(_id), callback(_callback)
104  {;}
105 
106  void operator()(T& x) { x->i()->registerHandlerCallback(id, callback); }
107  const std::string& id; const Tcallback& callback;
108  };
109 
110  template<class T, typename Tcallback>
111  struct unregisterHandlerCallback_f: public std::unary_function<T,void>
112  {
113  unregisterHandlerCallback_f(const std::string &_id)
114  : id(_id)
115  {;}
116 
117  void operator()(T& x) { x->i()->unregisterHandlerCallback(id); }
118  const std::string& id;
119  };
120 
121 
122 
123  const std::string d_type;
124  typedef std::vector<rpcmanager_base::rpcserver_booter_base_sptr> rpcServerMap_t;
125  std::vector<std::string> d_registeredServers;
126  rpcServerMap_t d_serverlist;
127 };
128 
129 #endif /* RPCSERVER_AGGREGATOR_H */
void registerQueryCallback(const std::string &id, const queryCallback_t callback)
Definition: rpccallbackregister_base.h:80
const std::string & type()
const std::vector< std::string > & registeredServers()
void registerServer(rpcmanager_base::rpcserver_booter_base_sptr server)
void registerConfigureCallback(const std::string &id, const configureCallback_t callback)
void unregisterQueryCallback(const std::string &id)
Definition: rpcserver_aggregator.h:31
void unregisterHandlerCallback(const std::string &id)
Definition: rpcserver_base.h:28
void unregisterConfigureCallback(const std::string &id)
virtual ~rpcserver_aggregator()
void registerHandlerCallback(const std::string &id, const handlerCallback_t callback)