Fawkes API  Fawkes Development Version
clingo_control_manager.h
1 /***************************************************************************
2  * clingo_control_manager.h - Clingo control manager
3  *
4  * Created: Thu Oct 27 16:23:32 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 #ifndef _PLUGINS_ASP_ASPECT_CLINGO_CONTROL_MANAGER_H_
24 #define _PLUGINS_ASP_ASPECT_CLINGO_CONTROL_MANAGER_H_
25 
26 #include <core/utils/lockptr.h>
27 
28 #include <unordered_map>
29 
30 namespace fawkes {
31 
32 class ClingoAccess;
33 class Logger;
34 
36 {
37 public:
39  virtual ~ClingoControlManager(void);
40 
41  void set_logger(Logger *logger);
42 
43  LockPtr<ClingoAccess> create_control(const std::string &ctrl_name,
44  const std::string &log_component_name);
45  void destroy_control(const std::string &ctrl_name);
46 
47  const std::unordered_map<std::string, LockPtr<ClingoAccess>> &controls(void) const;
48 
49 private:
50  Logger * logger_;
51  std::unordered_map<std::string, LockPtr<ClingoAccess>> controls_;
52 };
53 
54 } // end namespace fawkes
55 
56 #endif
Fawkes library namespace.
The Clingo Control Manager creates and maintains Clingo Controls.
void set_logger(Logger *logger)
Sets the logger for all Clingo Controls.
LockPtr<> is a reference-counting shared lockable smartpointer.
Definition: lockptr.h:54
virtual ~ClingoControlManager(void)
Destructor.
LockPtr< ClingoAccess > create_control(const std::string &ctrl_name, const std::string &log_component_name)
Create a new control.
void destroy_control(const std::string &ctrl_name)
"Destroys" the named control.
const std::unordered_map< std::string, LockPtr< ClingoAccess > > & controls(void) const
Get map of controls.
Interface for logging.
Definition: logger.h:41