GNU Radio Manual and C++ API Reference  3.7.4
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
44 
45  const std::string& type();
46 
47  const std::vector<std::string>& registeredServers();
48 
49 private:
50  template<class T, typename Tcallback>
51  struct registerConfigureCallback_f: public std::unary_function<T,void>
52  {
53  registerConfigureCallback_f(const std::string &_id, const Tcallback _callback)
54  : id(_id), callback(_callback)
55  {;}
56 
57  void operator()(T& x) { x->i()->registerConfigureCallback(id, callback); }
58  const std::string& id; const Tcallback& callback;
59  };
60 
61  template<class T, typename Tcallback>
62  struct unregisterConfigureCallback_f: public std::unary_function<T,void>
63  {
64  unregisterConfigureCallback_f(const std::string &_id)
65  : id(_id)
66  {;}
67 
68  void operator()(T& x) { x->i()->unregisterConfigureCallback(id); }
69  const std::string& id;
70  };
71 
72  template<class T, typename Tcallback>
73  struct registerQueryCallback_f: public std::unary_function<T,void>
74  {
75  registerQueryCallback_f(const std::string &_id, const Tcallback _callback)
76  : id(_id), callback(_callback)
77  {;}
78 
79  void operator()(T& x) { x->i()->registerQueryCallback(id, callback); }
80  const std::string& id; const Tcallback& callback;
81  };
82 
83  template<class T, typename Tcallback>
84  struct unregisterQueryCallback_f: public std::unary_function<T,void>
85  {
86  unregisterQueryCallback_f(const std::string &_id)
87  : id(_id)
88  {;}
89 
90  void operator()(T& x) { x->i()->unregisterQueryCallback(id); }
91  const std::string& id;
92  };
93 
94  const std::string d_type;
95  typedef std::vector<rpcmanager_base::rpcserver_booter_base_sptr> rpcServerMap_t;
96  std::vector<std::string> d_registeredServers;
97  rpcServerMap_t d_serverlist;
98 };
99 
100 #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)
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
Definition: rpcserver_aggregator.h:31
Definition: rpcserver_base.h:28
void unregisterConfigureCallback(const std::string &id)
virtual ~rpcserver_aggregator()