Fawkes API
Fawkes Development Version
clips-rest-api.h
1
2
/***************************************************************************
3
* clips-rest-api.h - CLIPS REST API
4
*
5
* Created: Sat Mar 31 01:35:21 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/Environment.h"
25
#include "model/Fact.h"
26
27
#include <aspect/logging.h>
28
#include <aspect/webview.h>
29
#include <clipsmm/fact.h>
30
#include <core/threading/thread.h>
31
#include <core/utils/lockptr.h>
32
#include <plugins/clips/aspect/clips_manager.h>
33
#include <webview/rest_api.h>
34
#include <webview/rest_array.h>
35
36
namespace
CLIPS {
37
class
Environment
;
38
}
39
40
class
ClipsRestApi
:
public
fawkes::Thread
,
41
public
fawkes::LoggingAspect
,
42
public
fawkes::WebviewAspect
,
43
public
fawkes::CLIPSManagerAspect
44
{
45
public
:
46
ClipsRestApi
();
47
~ClipsRestApi
();
48
49
virtual
void
init
();
50
virtual
void
loop
();
51
virtual
void
finalize
();
52
53
private
:
54
WebviewRestArray<Environment>
cb_list_environments();
55
WebviewRestArray<Fact>
cb_get_facts(
fawkes::WebviewRestParams
¶ms);
56
57
Fact
58
gen_fact(
fawkes::LockPtr<CLIPS::Environment>
&clips, CLIPS::Fact::pointer &fact,
bool
formatted);
59
60
private
:
61
fawkes::WebviewRestApi
*rest_api_;
62
};
ClipsRestApi::ClipsRestApi
ClipsRestApi()
Constructor.
Definition:
clips-rest-api.cpp:35
ClipsRestApi::init
virtual void init()
Initialize the thread.
Definition:
clips-rest-api.cpp:45
fawkes::LockPtr< CLIPS::Environment >
ClipsRestApi::finalize
virtual void finalize()
Finalize the thread.
Definition:
clips-rest-api.cpp:59
ClipsRestApi::loop
virtual void loop()
Code to execute in the thread.
Definition:
clips-rest-api.cpp:66
ClipsRestApi::~ClipsRestApi
~ClipsRestApi()
Destructor.
Definition:
clips-rest-api.cpp:40
fawkes::LoggingAspect
Definition:
logging.h:36
WebviewRestArray
Container to return array via REST.
Definition:
rest_array.h:34
fawkes::WebviewRestParams
REST parameters to pass to handlers.
Definition:
rest_api.h:127
fawkes::WebviewAspect
Definition:
webview.h:40
ClipsRestApi
Definition:
clips-rest-api.h:39
fawkes::WebviewRestApi
Definition:
rest_api.h:223
fawkes::Thread
Definition:
thread.h:44
fawkes::CLIPSManagerAspect
Definition:
clips_manager.h:39
Environment
Environment representation for JSON transfer.
Definition:
Environment.h:25
Fact
Fact representation for JSON transfer.
Definition:
Fact.h:27
src
plugins
clips
rest-api
clips-rest-api.h
Generated by
1.8.16