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 <string>
29#include <unordered_map>
30
31namespace fawkes {
32
33class ClingoAccess;
34class Logger;
35
37{
38public:
40 virtual ~ClingoControlManager(void);
41
42 void set_logger(Logger *logger);
43
44 LockPtr<ClingoAccess> create_control(const std::string &ctrl_name,
45 const std::string &log_component_name);
46 void destroy_control(const std::string &ctrl_name);
47
48 const std::unordered_map<std::string, LockPtr<ClingoAccess>> &controls(void) const;
49
50private:
51 Logger * logger_;
52 std::unordered_map<std::string, LockPtr<ClingoAccess>> controls_;
53};
54
55} // end namespace fawkes
56
57#endif
The Clingo Control Manager creates and maintains Clingo Controls.
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.
virtual ~ClingoControlManager(void)
Destructor.
const std::unordered_map< std::string, LockPtr< ClingoAccess > > & controls(void) const
Get map of controls.
void set_logger(Logger *logger)
Sets the logger for all Clingo Controls.
LockPtr<> is a reference-counting shared lockable smartpointer.
Definition: lockptr.h:55
Interface for logging.
Definition: logger.h:42
Fawkes library namespace.