Fawkes API  Fawkes Development Version
openprs_kernel_manager.h
1 
2 /***************************************************************************
3  * openprs_kernel_manager.h - OpenPRS kernel manager
4  *
5  * Created: Mon Aug 18 15:12:57 2014
6  * Copyright 2006-2014 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. 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_OPENPRS_ASPECT_OPENPRS_ENV_MANAGER_H_
24 #define __PLUGINS_OPENPRS_ASPECT_OPENPRS_ENV_MANAGER_H_
25 
26 #include <core/utils/lockptr.h>
27 #include <string>
28 #include <map>
29 #include <list>
30 
31 namespace fawkes {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
36 class Logger;
37 class Clock;
38 class Configuration;
39 class SubProcess;
40 
42 {
43  public:
44  OpenPRSKernelManager(const std::string &server_host, unsigned short server_tcp_port,
45  const std::string &mp_host, unsigned short mp_tcp_port,
46  Logger *logger, Clock *clock, Configuration *config);
47  virtual ~OpenPRSKernelManager();
48 
49  void create_kernel(const std::string &kernel_name, bool use_xoprs,
50  std::list<std::string> &extra_data_path, bool utils_gdb_delay);
51  void destroy_kernel(const std::string &kernel_name);
52 
53  std::list<std::string> kernels() const;
54 
55  /** Get oprs-server hostname.
56  * @return hostname where oprs-server is running */
57  const std::string & server_host() const
58  { return server_host_; }
59 
60  /** Get oprs-server TCP port.
61  * @return TCP port where oprs-server is listening */
62  unsigned short server_port() const
63  { return server_port_; }
64 
65  /** Get mp-oprs hostname.
66  * @return hostname where mp-oprs is running */
67  const std::string & mp_host() const
68  { return mp_host_; }
69 
70  /** Get mp-oprs TCP port.
71  * @return TCP port where mp-oprs is listening */
72  unsigned short mp_port() const
73  { return mp_port_; }
74 
75  private:
76  const std::string server_host_;
77  const unsigned short server_port_;
78  const std::string mp_host_;
79  const unsigned short mp_port_;
80 
81  Logger *logger_;
82  Clock *clock_;
83  Configuration *config_;
84 
85  std::map<std::string, fawkes::SubProcess *> kernels_;
86 };
87 
88 } // end namespace fawkes
89 
90 #endif
OpenPRSKernelManager(const std::string &server_host, unsigned short server_tcp_port, const std::string &mp_host, unsigned short mp_tcp_port, Logger *logger, Clock *clock, Configuration *config)
Constructor.
const std::string & mp_host() const
Get mp-oprs hostname.
Fawkes library namespace.
void create_kernel(const std::string &kernel_name, bool use_xoprs, std::list< std::string > &extra_data_path, bool utils_gdb_delay)
Create a new kernel.
This is supposed to be the central clock in Fawkes.
Definition: clock.h:34
std::list< std::string > kernels() const
Get map of kernels.
void destroy_kernel(const std::string &kernel_name)
Destroy the named kernel.
virtual ~OpenPRSKernelManager()
Destructor.
unsigned short mp_port() const
Get mp-oprs TCP port.
const std::string & server_host() const
Get oprs-server hostname.
Interface for configuration handling.
Definition: config.h:67
unsigned short server_port() const
Get oprs-server TCP port.
Interface for logging.
Definition: logger.h:34