Fawkes API
Fawkes Development Version
|
Initialization options class. More...
#include <>>
Public Member Functions | |
InitOptions (const char *basename) | |
Constructor. More... | |
InitOptions (int argc, char **argv) | |
Constructor from arguments. More... | |
InitOptions (const InitOptions &options) | |
Copy constructor. More... | |
~InitOptions () | |
Destructor. More... | |
InitOptions & | operator= (const InitOptions &options) |
Assignment operator. More... | |
InitOptions & | net_tcp_port (unsigned short int port) |
Set Fawkes network TCP port. More... | |
InitOptions & | net_service_name (const char *service_name) |
Set Fawkes network service name. More... | |
InitOptions & | daemonize (bool daemonize, bool kill=false, bool status=false, const char *pid_file=0) |
Set daemonization options. More... | |
InitOptions & | loggers (const char *loggers) |
Set loggers. More... | |
InitOptions & | log_level (Logger::LogLevel log_level) |
Set log level. More... | |
InitOptions & | show_help (bool show_help) |
Set to show help. More... | |
InitOptions & | user (const char *username) |
Set user name to run as. More... | |
InitOptions & | group (const char *groupname) |
Set group name to run as. More... | |
InitOptions & | config_file (const char *config_file) |
Set config file path. More... | |
InitOptions & | bb_cleanup (bool bb_cleanup) |
Set blackboard cleanup. More... | |
InitOptions & | init_plugin_cache (bool init_plugin_cache) |
Enable or disable plugin cache initialization. More... | |
InitOptions & | load_plugins (const char *plugin_list) |
Set list of plugins to load during startup. More... | |
InitOptions & | default_plugin (const char *default_plugin) |
Set additional default plugin name. More... | |
InitOptions & | plugin_module_flags (Module::ModuleFlags flags) |
Set module flags. More... | |
InitOptions & | default_signal_handlers (bool enable) |
Set default signal handlers. More... | |
const char * | basename () const |
Get program basename. More... | |
bool | has_net_tcp_port () const |
Check if TCP port has been passed. More... | |
unsigned short int | net_tcp_port () const |
Get Fawkes network TCP port. More... | |
bool | has_net_service_name () const |
Check if network service name has been passed. More... | |
const char * | net_service_name () const |
Get network service name. More... | |
bool | has_load_plugin_list () const |
Check if plugin load list has been set. More... | |
const char * | load_plugin_list () const |
Get plugin load list. More... | |
const char * | default_plugin () const |
Get name of default plugin. More... | |
bool | has_loggers () const |
Check if logger string has been passed. More... | |
const char * | loggers () const |
Get logger string. More... | |
Logger::LogLevel | log_level () const |
Get log level. More... | |
bool | show_help () const |
Check if help has been requested. More... | |
bool | bb_cleanup () const |
Check if blackboard cleanup has been requested. More... | |
bool | init_plugin_cache () const |
Check if plugin cache initialization has been requested. More... | |
bool | daemonize () const |
Check if daemonization has been requested. More... | |
bool | daemonize_kill () const |
Check if killing of daemon has been requested. More... | |
bool | daemonize_status () const |
Check if status of daemon has been requested. More... | |
const char * | daemon_pid_file () const |
Get daemon PID file. More... | |
bool | has_username () const |
Check if user name has been passed. More... | |
const char * | username () const |
Get user name to run as. More... | |
bool | has_groupname () const |
Check if group name has been passed. More... | |
const char * | groupname () const |
Get group name to run as. More... | |
const char * | config_file () const |
Get config file path. More... | |
Module::ModuleFlags | plugin_module_flags () const |
Get plugin module flags. More... | |
bool | default_signal_handlers () const |
Check if default signal handlers should be enabled. More... | |
Initialization options class.
This class provides a container for initialization options that can be passed to the Fawkes runtime. It uses the named parameter idiom which allows to set only the parameters which divert from the default value.
Definition at line 37 of file init_options.h.
fawkes::runtime::InitOptions::InitOptions | ( | const char * | basename | ) |
Constructor.
Initializes the default options.
basename | program base name |
Definition at line 52 of file init_options.cpp.
References fawkes::Logger::LL_DEBUG, and fawkes::Module::MODULE_FLAGS_DEFAULT.
fawkes::runtime::InitOptions::InitOptions | ( | int | argc, |
char ** | argv | ||
) |
Constructor from arguments.
Initializes the options from arguments passed from the command line.
argc | number of elements in argv |
argv | argument array |
Definition at line 149 of file init_options.cpp.
References fawkes::ArgumentParser::arg(), fawkes::ArgumentParser::has_arg(), fawkes::ArgumentParser::items(), fawkes::Logger::LL_DEBUG, fawkes::Logger::LL_ERROR, fawkes::Logger::LL_INFO, fawkes::Logger::LL_NONE, fawkes::Logger::LL_WARN, fawkes::Module::MODULE_FLAGS_DEFAULT, fawkes::ArgumentParser::num_items(), fawkes::ArgumentParser::parse_int(), and fawkes::ArgumentParser::program_name().
fawkes::runtime::InitOptions::InitOptions | ( | const InitOptions & | options | ) |
Copy constructor.
options | options object to copy |
Definition at line 85 of file init_options.cpp.
fawkes::runtime::InitOptions::~InitOptions | ( | ) |
Destructor.
Definition at line 281 of file init_options.cpp.
const char * fawkes::runtime::InitOptions::basename | ( | ) | const |
InitOptions & fawkes::runtime::InitOptions::bb_cleanup | ( | bool | bb_cleanup | ) |
Set blackboard cleanup.
bb_cleanup | true to run blackboard cleanup, false otherwise |
Definition at line 586 of file init_options.cpp.
References bb_cleanup().
bool fawkes::runtime::InitOptions::bb_cleanup | ( | ) | const |
Check if blackboard cleanup has been requested.
Definition at line 737 of file init_options.cpp.
Referenced by bb_cleanup().
InitOptions & fawkes::runtime::InitOptions::config_file | ( | const char * | config_file | ) |
Set config file path.
config_file | config file path |
Definition at line 569 of file init_options.cpp.
const char * fawkes::runtime::InitOptions::config_file | ( | ) | const |
const char * fawkes::runtime::InitOptions::daemon_pid_file | ( | ) | const |
InitOptions & fawkes::runtime::InitOptions::daemonize | ( | bool | daemonize, |
bool | kill = false , |
||
bool | status = false , |
||
const char * | pid_file = 0 |
||
) |
Set daemonization options.
daemonize | daemonization requested |
kill | kill a running daemon |
status | print status about running daemon |
pid_file | path to file to write PID to |
Definition at line 443 of file init_options.cpp.
References daemonize().
bool fawkes::runtime::InitOptions::daemonize | ( | ) | const |
Check if daemonization has been requested.
Definition at line 766 of file init_options.cpp.
Referenced by daemonize().
bool fawkes::runtime::InitOptions::daemonize_kill | ( | ) | const |
Check if killing of daemon has been requested.
Definition at line 775 of file init_options.cpp.
bool fawkes::runtime::InitOptions::daemonize_status | ( | ) | const |
Check if status of daemon has been requested.
Definition at line 784 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::default_plugin | ( | const char * | default_plugin_ | ) |
Set additional default plugin name.
default_plugin_ | additional default plugin name |
Definition at line 397 of file init_options.cpp.
Referenced by NaoFawkesModule::NaoFawkesModule().
const char * fawkes::runtime::InitOptions::default_plugin | ( | ) | const |
Get name of default plugin.
This is usually the name of a meta plugin to load the appropriate plugins. It may have a specialized name on a specific robot platform. It defaults to "default". Note that "default" is always loaded to avoid confusion.
Definition at line 637 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::default_signal_handlers | ( | bool | enable | ) |
Set default signal handlers.
enable | true to enable default signal handlers, false to disable. Note that if you disable the signal handlers you must stop the Fawkes main thread execution by yourself by some other means. |
Definition at line 612 of file init_options.cpp.
bool fawkes::runtime::InitOptions::default_signal_handlers | ( | ) | const |
Check if default signal handlers should be enabled.
Definition at line 757 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::group | ( | const char * | groupname | ) |
Set group name to run as.
groupname | user name to run as |
Definition at line 551 of file init_options.cpp.
const char * fawkes::runtime::InitOptions::groupname | ( | ) | const |
Get group name to run as.
Definition at line 832 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_groupname | ( | ) | const |
Check if group name has been passed.
Definition at line 823 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_load_plugin_list | ( | ) | const |
Check if plugin load list has been set.
Definition at line 683 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_loggers | ( | ) | const |
Check if logger string has been passed.
Definition at line 701 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_net_service_name | ( | ) | const |
Check if network service name has been passed.
Definition at line 665 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_net_tcp_port | ( | ) | const |
Check if TCP port has been passed.
Definition at line 647 of file init_options.cpp.
bool fawkes::runtime::InitOptions::has_username | ( | ) | const |
Check if user name has been passed.
Definition at line 804 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::init_plugin_cache | ( | bool | init_cache | ) |
Enable or disable plugin cache initialization.
init_cache | true to trigger plugin cache initialization, false to disable |
Definition at line 501 of file init_options.cpp.
bool fawkes::runtime::InitOptions::init_plugin_cache | ( | ) | const |
Check if plugin cache initialization has been requested.
Definition at line 747 of file init_options.cpp.
const char * fawkes::runtime::InitOptions::load_plugin_list | ( | ) | const |
InitOptions & fawkes::runtime::InitOptions::load_plugins | ( | const char * | plugin_list | ) |
Set list of plugins to load during startup.
plugin_list | comma-separated list of names of plugins to load |
Definition at line 531 of file init_options.cpp.
Referenced by NaoFawkesModule::NaoFawkesModule().
InitOptions & fawkes::runtime::InitOptions::log_level | ( | Logger::LogLevel | log_level | ) |
Set log level.
log_level | desired log level |
Definition at line 478 of file init_options.cpp.
References log_level().
Logger::LogLevel fawkes::runtime::InitOptions::log_level | ( | ) | const |
Get log level.
Definition at line 719 of file init_options.cpp.
Referenced by log_level().
InitOptions & fawkes::runtime::InitOptions::loggers | ( | const char * | loggers | ) |
Set loggers.
loggers | string of loggers |
Definition at line 460 of file init_options.cpp.
Referenced by NaoFawkesModule::NaoFawkesModule().
const char * fawkes::runtime::InitOptions::loggers | ( | ) | const |
InitOptions & fawkes::runtime::InitOptions::net_service_name | ( | const char * | service_name | ) |
Set Fawkes network service name.
service_name | service name |
Definition at line 422 of file init_options.cpp.
Referenced by NaoFawkesModule::NaoFawkesModule().
const char * fawkes::runtime::InitOptions::net_service_name | ( | ) | const |
Get network service name.
Definition at line 674 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::net_tcp_port | ( | unsigned short int | port | ) |
Set Fawkes network TCP port.
port | TCP port |
Definition at line 410 of file init_options.cpp.
unsigned short int fawkes::runtime::InitOptions::net_tcp_port | ( | ) | const |
Get Fawkes network TCP port.
Definition at line 656 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::operator= | ( | const InitOptions & | options | ) |
Assignment operator.
options | options object to copy |
Definition at line 300 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::plugin_module_flags | ( | Module::ModuleFlags | flags | ) |
Set module flags.
flags | flags to open plugin modules with |
Definition at line 598 of file init_options.cpp.
Referenced by NaoFawkesModule::NaoFawkesModule().
Module::ModuleFlags fawkes::runtime::InitOptions::plugin_module_flags | ( | ) | const |
Get plugin module flags.
Definition at line 852 of file init_options.cpp.
InitOptions & fawkes::runtime::InitOptions::show_help | ( | bool | show_help | ) |
Set to show help.
show_help | true to request showing help information, false otherwise |
Definition at line 489 of file init_options.cpp.
References show_help().
bool fawkes::runtime::InitOptions::show_help | ( | ) | const |
Check if help has been requested.
Definition at line 728 of file init_options.cpp.
Referenced by show_help().
InitOptions & fawkes::runtime::InitOptions::user | ( | const char * | username | ) |
Set user name to run as.
username | user name to run as |
Definition at line 512 of file init_options.cpp.
const char * fawkes::runtime::InitOptions::username | ( | ) | const |
Get user name to run as.
Definition at line 814 of file init_options.cpp.