Fawkes API
Fawkes Development Version
blackboard-rest-api.h
1
2
/***************************************************************************
3
* blackboard-rest-api.h - Blackboard REST API
4
*
5
* Created: Mon Mar 26 23:26:40 2018
6
* Copyright 2006-2018 Tim Niemueller [www.niemueller.de]
7
****************************************************************************/
8
9
/* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Library General Public License for more details.
18
*
19
* Read the full text in the LICENSE.GPL file in the doc directory.
20
*/
21
22
#pragma once
23
24
#include "model/BlackboardGraph.h"
25
#include "model/InterfaceData.h"
26
#include "model/InterfaceInfo.h"
27
28
#include <aspect/blackboard.h>
29
#include <aspect/clock.h>
30
#include <aspect/logging.h>
31
#include <aspect/webview.h>
32
#include <core/threading/thread.h>
33
#include <interface/field_iterator.h>
34
#include <interface/interface_info.h>
35
#include <webview/rest_api.h>
36
#include <webview/rest_array.h>
37
38
#include <map>
39
#include <string>
40
#include <utility>
41
42
class
BlackboardRestApi
:
public
fawkes::Thread
,
43
public
fawkes::ClockAspect
,
44
public
fawkes::LoggingAspect
,
45
public
fawkes::BlackBoardAspect
,
46
public
fawkes::WebviewAspect
47
{
48
public
:
49
BlackboardRestApi
();
50
~BlackboardRestApi
();
51
52
virtual
void
init
();
53
virtual
void
loop
();
54
virtual
void
finalize
();
55
56
private
:
57
WebviewRestArray<InterfaceInfo>
cb_list_interfaces();
58
59
InterfaceInfo
cb_get_interface_info(
fawkes::WebviewRestParams
¶ms);
60
61
InterfaceData
cb_get_interface_data(
fawkes::WebviewRestParams
¶ms);
62
63
BlackboardGraph
cb_get_graph();
64
65
std::vector<std::shared_ptr<InterfaceFieldType>> gen_fields(
fawkes::InterfaceFieldIterator
begin,
66
fawkes::InterfaceFieldIterator
end);
67
68
InterfaceInfo
gen_interface_info(
const
fawkes::InterfaceInfo
&ii);
69
InterfaceData
gen_interface_data(
fawkes::Interface
*iface,
bool
pretty);
70
71
std::string generate_graph(
const
std::string &for_owner =
""
);
72
73
private
:
74
fawkes::WebviewRestApi
*rest_api_;
75
76
std::map<std::string,
77
std::pair<std::vector<std::shared_ptr<InterfaceFieldType>>,
78
std::vector<std::shared_ptr<InterfaceMessageType>>>>
79
type_info_cache_;
80
};
BlackboardRestApi::finalize
virtual void finalize()
Finalize the thread.
Definition:
blackboard-rest-api.cpp:73
InterfaceInfo
InterfaceInfo representation for JSON transfer.
Definition:
InterfaceInfo.h:28
BlackboardRestApi
Definition:
blackboard-rest-api.h:41
BlackboardRestApi::BlackboardRestApi
BlackboardRestApi()
Constructor.
Definition:
blackboard-rest-api.cpp:41
InterfaceData
InterfaceData representation for JSON transfer.
Definition:
InterfaceData.h:25
fawkes::InterfaceFieldIterator
Definition:
field_iterator.h:37
fawkes::BlackBoardAspect
Definition:
blackboard.h:36
fawkes::LoggingAspect
Definition:
logging.h:36
WebviewRestArray
Container to return array via REST.
Definition:
rest_array.h:34
fawkes::Interface
Definition:
interface.h:77
fawkes::WebviewRestParams
REST parameters to pass to handlers.
Definition:
rest_api.h:127
BlackboardGraph
BlackboardGraph representation for JSON transfer.
Definition:
BlackboardGraph.h:25
fawkes::WebviewAspect
Definition:
webview.h:40
fawkes::WebviewRestApi
Definition:
rest_api.h:223
fawkes::Thread
Definition:
thread.h:44
BlackboardRestApi::init
virtual void init()
Initialize the thread.
Definition:
blackboard-rest-api.cpp:51
BlackboardRestApi::loop
virtual void loop()
Code to execute in the thread.
Definition:
blackboard-rest-api.cpp:80
fawkes::InterfaceInfo
Definition:
interface_info.h:38
fawkes::ClockAspect
Definition:
clock.h:38
BlackboardRestApi::~BlackboardRestApi
~BlackboardRestApi()
Destructor.
Definition:
blackboard-rest-api.cpp:46
src
plugins
webview
blackboard-rest-api
blackboard-rest-api.h
Generated by
1.8.16