Fawkes API  Fawkes Development Version
asp_thread.cpp
1 /***************************************************************************
2  * asp_thread.cpp - ASP environment providing Thread
3  *
4  * Created: Thu Oct 20 15:49:31 2016
5  * Copyright 2016 Björn Schäpers
6  *
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 #include "asp_thread.h"
23 
24 #include <clingo.hh>
25 
26 using namespace fawkes;
27 
28 /** @class ASPThread "clips_thread.h"
29  * ASP environment thread.
30  *
31  * @author Björn Schäpers
32  *
33  * @property ASPThread::asp_inifin_
34  * @brief The initializer/finalizer for the ASPAspect.
35  *
36  * @property ASPThread::clingo_mgr_inifin_
37  * @brief The initializer/finalizer for the ClingoManagerAspect.
38  *
39  * @property ASPThread::control_mgr_
40  * @brief The clingo control manager.
41  */
42 
43 /** Constructor. */
45 : Thread("ASPThread", Thread::OPMODE_WAITFORWAKEUP),
46  AspectProviderAspect({&asp_inifin_, &clingo_mgr_inifin_}),
47  control_mgr_(new ClingoControlManager)
48 {
49 }
50 
51 void
53 {
54  control_mgr_->set_logger(logger);
55  asp_inifin_.set_control_manager(control_mgr_);
56  clingo_mgr_inifin_.set_control_manager(control_mgr_);
57 }
58 
59 void
61 {
62 }
63 
64 void
66 {
67 }
Fawkes library namespace.
The Clingo Control Manager creates and maintains Clingo Controls.
void set_logger(Logger *logger)
Sets the logger for all Clingo Controls.
void set_control_manager(LockPtr< ClingoControlManager > &clingo_ctrl_mgr)
Set Clingo control manger.
Thread class encapsulation of pthreads.
Definition: thread.h:45
void set_control_manager(const LockPtr< ClingoControlManager > &ctrl_mgr)
Sets the control manager.
Definition: asp_inifin.cpp:84
ASPThread()
Constructor.
Definition: asp_thread.cpp:44
Logger * logger
This is the Logger member used to access the logger.
Definition: logging.h:41
void loop() override
Code to execute in the thread.
Definition: asp_thread.cpp:65
void init() override
Initialize the thread.
Definition: asp_thread.cpp:52
Thread aspect provide a new aspect.
void finalize() override
Finalize the thread.
Definition: asp_thread.cpp:60