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