Fawkes API  Fawkes Development Version
clingo_manager.cpp
1 /***************************************************************************
2  * clingo_manager.cpp - Clingo manager aspect for Fawkes
3  *
4  * Created: Sat Oct 29 11:30:07 2016
5  * Copyright 2016 Björn Schäpers
6  * 2018 Tim Niemueller [www.niemueller.org]
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. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
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_WRE file in the doc directory.
21  */
22 
23 #include <plugins/asp/aspect/clingo_manager.h>
24 
25 namespace fawkes {
26 
27 /** @class ClingoManagerAspect <plugins/asp/aspect/clingo_manager.h>
28  * Thread aspect to access the Clingo Control manager.
29 
30  * Give this aspect to your thread if you want to access the Clingo control manager.
31  * Use this with extreme care and only if you know what you are doing.
32  * If you want to create a Clingo control to work with use the ASPAspect.
33  *
34  * @ingroup Aspects
35  * @author Björn Schäpers
36  *
37  * @property ClingoManagerAspect::clingo_ctrl_mgr
38  * The Clingo control manager.
39  */
40 
41 /** Constructor. */
43 {
44  add_aspect("ClingoManagerAspect");
45 }
46 
47 /** Virtual empty destructor. */
49 {
50 }
51 
52 /** Init ClingoManagerAspect.
53  * This sets the Clingo Control Manager.
54  * @param[in] clingo_ctrl_mgr The Clingo Control Manager
55  */
56 void
58 {
59  this->clingo_ctrl_mgr = clingo_ctrl_mgr;
60 }
61 
62 /** Finalize ASP aspect.
63  * This clears the Clingo Control.
64  */
65 void
67 {
68  clingo_ctrl_mgr.clear();
69 }
70 
71 } // end namespace fawkes
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
void finalize_ClingoManagerAspect(void)
Finalize ASP aspect.
LockPtr< ClingoControlManager > clingo_ctrl_mgr
The Clingo control manager.
ClingoManagerAspect(void)
Constructor.
void init_ClingoManagerAspect(const LockPtr< ClingoControlManager > &clingo_ctrl_mgr)
Init ClingoManagerAspect.
virtual ~ClingoManagerAspect(void)
Virtual empty destructor.
LockPtr<> is a reference-counting shared lockable smartpointer.
Definition: lockptr.h:55
Fawkes library namespace.