Fawkes API  Fawkes Development Version
init_options.h
1 
2 /***************************************************************************
3  * init_options.h - Fawkes run-time initialization options
4  *
5  * Created: Tue Jun 07 14:06:56 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __LIBS_BASEAPP_INIT_OPTIONS_H_
25 #define __LIBS_BASEAPP_INIT_OPTIONS_H_
26 
27 #include <logging/logger.h>
28 #include <utils/system/dynamic_module/module.h>
29 
30 namespace fawkes {
31  namespace runtime {
32 #if 0 /* just to make Emacs auto-indent happy */
33  }
34 }
35 #endif
36 
38 {
39  public:
40  InitOptions(const char *basename);
41  InitOptions(int argc, char **argv);
42  InitOptions(const InitOptions &options);
43  ~InitOptions();
44 
45  InitOptions & operator=(const InitOptions &options);
46 
47  InitOptions & net_tcp_port(unsigned short int port);
48  InitOptions & net_service_name(const char *service_name);
50  bool kill = false, bool status = false,
51  const char *pid_file = 0);
52  InitOptions & loggers(const char *loggers);
55  InitOptions & user(const char *username);
56  InitOptions & group(const char *groupname);
58  InitOptions & host_config(const char *host_config);
61  InitOptions & load_plugins(const char *plugin_list);
64  InitOptions & default_signal_handlers(bool enable);
65 
66  const char *basename() const;
67 
68  bool has_net_tcp_port() const;
69  unsigned short int net_tcp_port() const;
70  bool has_net_service_name() const;
71  const char * net_service_name() const;
72 
73  bool has_load_plugin_list() const;
74  const char * load_plugin_list() const;
75  const char * default_plugin() const;
76 
77 
78  bool has_loggers() const;
79  const char * loggers() const;
81 
82  bool show_help() const;
83  bool bb_cleanup() const;
84  bool init_plugin_cache() const;
85 
86  bool daemonize() const;
87  bool daemonize_kill() const;
88  bool daemonize_status() const;
89  const char * daemon_pid_file() const;
90 
91 
92  bool has_username() const;
93  const char * username() const;
94  bool has_groupname() const;
95  const char * groupname() const;
96 
97  const char * host_config() const;
98  const char * default_config() const;
99 
101 
102  bool default_signal_handlers() const;
103 
104  private:
105  char *__basename;
106 
107  bool __has_net_tcp_port;
108  unsigned short int __net_tcp_port;
109 
110  bool __has_load_plugin_list;
111  char *__load_plugin_list;
112  char *__default_plugin;
113 
114  bool __has_loggers;
115  char *__loggers;
116  Logger::LogLevel __log_level;
117 
118  bool __has_net_service_name;
119  char *__net_service_name;
120 
121  bool __has_username;
122  char *__username;
123  bool __has_groupname;
124  char *__groupname;
125 
126  char *__default_config;
127  char *__host_config;
128 
129  bool __daemonize;
130  char *__daemon_pid_file;
131  bool __daemonize_kill;
132  bool __daemonize_status;
133 
134  bool __show_help;
135  bool __bb_cleanup;
136 
137  bool __init_plugin_cache;
138  Module::ModuleFlags __plugin_module_flags;
139  bool __default_signal_handlers;
140 
141 };
142 
143 
144 } // end namespace runtime
145 } // end namespace fawkes
146 
147 #endif
const char * username() const
Get user name to run as.
bool has_net_tcp_port() const
Check if TCP port has been passed.
LogLevel
Log level.
Definition: logger.h:45
bool daemonize_status() const
Check if status of daemon has been requested.
Logger::LogLevel log_level() const
Get log level.
bool has_loggers() const
Check if logger string has been passed.
bool has_groupname() const
Check if group name has been passed.
const char * load_plugin_list() const
Get plugin load list.
bool default_signal_handlers() const
Check if default signal handlers should be enabled.
bool show_help() const
Check if help has been requested.
bool init_plugin_cache() const
Check if plugin cache initialization has been requested.
Fawkes library namespace.
InitOptions & load_plugins(const char *plugin_list)
Set list of plugins to load during startup.
bool bb_cleanup() const
Check if blackboard cleanup has been requested.
bool has_net_service_name() const
Check if network service name has been passed.
InitOptions & operator=(const InitOptions &options)
Assignment operator.
ModuleFlags
Flags for the loading process.
Definition: module.h:44
unsigned short int net_tcp_port() const
Get Fawkes network TCP port.
Initialization options class.
Definition: init_options.h:37
const char * net_service_name() const
Get network service name.
const char * host_config() const
Get host config.
bool has_username() const
Check if user name has been passed.
const char * groupname() const
Get group name to run as.
InitOptions & user(const char *username)
Set user name to run as.
const char * loggers() const
Get logger string.
Module::ModuleFlags plugin_module_flags() const
Get plugin module flags.
bool has_load_plugin_list() const
Check if plugin load list has been set.
const char * default_config() const
Get default config.
const char * default_plugin() const
Get name of default plugin.
InitOptions(const char *basename)
Constructor.
bool daemonize_kill() const
Check if killing of daemon has been requested.
InitOptions & group(const char *groupname)
Set group name to run as.
const char * basename() const
Get program basename.
const char * daemon_pid_file() const
Get daemon PID file.
bool daemonize() const
Check if daemonization has been requested.