Fawkes API  Fawkes Development Version
rest_api_manager.h
1 
2 /***************************************************************************
3  * rest_api_manager.h - Webview REST API manager
4  *
5  * Created: Fri Mar 16 16:42:36 2018
6  * Copyright 2006-2018 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _LIBS_WEBVIEW_REST_API_MANAGER_H_
24 #define _LIBS_WEBVIEW_REST_API_MANAGER_H_
25 
26 #include <core/threading/mutex.h>
27 
28 #include <map>
29 #include <string>
30 
31 namespace fawkes {
32 
33 class Mutex;
34 class WebviewRestApi;
35 
36 class WebviewRestApiManager
37 {
38 public:
41 
43  void unregister_api(WebviewRestApi *api);
44 
45  WebviewRestApi *get_api(std::string &name);
46  Mutex & mutex();
47 
48 private:
49  Mutex mutex_;
50  std::map<std::string, WebviewRestApi *> apis_;
51 };
52 
53 } // end namespace fawkes
54 
55 #endif
fawkes::WebviewRestApiManager::get_api
WebviewRestApi * get_api(std::string &name)
Find API by name.
Definition: rest_api_manager.cpp:87
fawkes::Mutex
Definition: mutex.h:38
fawkes::WebviewRestApiManager::mutex
Mutex & mutex()
Get internal mutex.
Definition: rest_api_manager.cpp:102
fawkes::WebviewRestApiManager::~WebviewRestApiManager
~WebviewRestApiManager()
Destructor.
Definition: rest_api_manager.cpp:50
fawkes::WebviewRestApiManager::unregister_api
void unregister_api(WebviewRestApi *api)
Remove a request processor.
Definition: rest_api_manager.cpp:73
fawkes::WebviewRestApiManager::register_api
void register_api(WebviewRestApi *api)
Add a REST API.
Definition: rest_api_manager.cpp:60
fawkes
fawkes::WebviewRestApi
Definition: rest_api.h:225
fawkes::WebviewRestApiManager::WebviewRestApiManager
WebviewRestApiManager()
Constructor.
Definition: rest_api_manager.cpp:45