Fawkes API Fawkes Development Version
fawkes::runtime::InitOptions Class Reference

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...
 
InitOptionsoperator= (const InitOptions &options)
 Assignment operator. More...
 
InitOptionsnet_tcp_port (unsigned short int port)
 Set Fawkes network TCP port. More...
 
InitOptionsnet_service_name (const char *service_name)
 Set Fawkes network service name. More...
 
InitOptionsdaemonize (bool daemonize, bool kill=false, bool status=false, const char *pid_file=0)
 Set daemonization options. More...
 
InitOptionsloggers (const char *loggers)
 Set loggers. More...
 
InitOptionslog_level (Logger::LogLevel log_level)
 Set log level. More...
 
InitOptionsshow_help (bool show_help)
 Set to show help. More...
 
InitOptionsuser (const char *username)
 Set user name to run as. More...
 
InitOptionsgroup (const char *groupname)
 Set group name to run as. More...
 
InitOptionsconfig_file (const char *config_file)
 Set config file path. More...
 
InitOptionsbb_cleanup (bool bb_cleanup)
 Set blackboard cleanup. More...
 
InitOptionsinit_plugin_cache (bool init_plugin_cache)
 Enable or disable plugin cache initialization. More...
 
InitOptionsload_plugins (const char *plugin_list)
 Set list of plugins to load during startup. More...
 
InitOptionsdefault_plugin (const char *default_plugin)
 Set additional default plugin name. More...
 
InitOptionsplugin_module_flags (Module::ModuleFlags flags)
 Set module flags. More...
 
InitOptionsdefault_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...
 

Detailed Description

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.

Author
Tim Niemueller

Definition at line 33 of file init_options.h.

Constructor & Destructor Documentation

◆ InitOptions() [1/3]

fawkes::runtime::InitOptions::InitOptions ( const char *  basename)

Constructor.

Initializes the default options.

Parameters
basenameprogram base name

Definition at line 46 of file init_options.cpp.

References basename(), fawkes::Logger::LL_DEBUG, and fawkes::Module::MODULE_FLAGS_DEFAULT.

◆ InitOptions() [2/3]

fawkes::runtime::InitOptions::InitOptions ( int  argc,
char **  argv 
)

◆ InitOptions() [3/3]

fawkes::runtime::InitOptions::InitOptions ( const InitOptions options)

Copy constructor.

Parameters
optionsoptions object to copy

Definition at line 78 of file init_options.cpp.

◆ ~InitOptions()

fawkes::runtime::InitOptions::~InitOptions ( )

Destructor.

Definition at line 265 of file init_options.cpp.

Member Function Documentation

◆ basename()

const char * fawkes::runtime::InitOptions::basename ( ) const

Get program basename.

Returns
program base name

Definition at line 604 of file init_options.cpp.

Referenced by InitOptions().

◆ bb_cleanup() [1/2]

bool fawkes::runtime::InitOptions::bb_cleanup ( ) const

Check if blackboard cleanup has been requested.

Returns
true if blackboard cleanup has been requested, false otherwise

Definition at line 716 of file init_options.cpp.

Referenced by bb_cleanup().

◆ bb_cleanup() [2/2]

InitOptions & fawkes::runtime::InitOptions::bb_cleanup ( bool  bb_cleanup)

Set blackboard cleanup.

Parameters
bb_cleanuptrue to run blackboard cleanup, false otherwise
Returns
reference to this instance

Definition at line 570 of file init_options.cpp.

References bb_cleanup().

◆ config_file() [1/2]

const char * fawkes::runtime::InitOptions::config_file ( ) const

Get config file path.

Returns
config file path

Definition at line 815 of file init_options.cpp.

Referenced by config_file().

◆ config_file() [2/2]

InitOptions & fawkes::runtime::InitOptions::config_file ( const char *  config_file)

Set config file path.

Parameters
config_fileconfig file path
Returns
reference to this instance

Definition at line 553 of file init_options.cpp.

References config_file().

◆ daemon_pid_file()

const char * fawkes::runtime::InitOptions::daemon_pid_file ( ) const

Get daemon PID file.

Returns
daemon PID file path

Definition at line 770 of file init_options.cpp.

◆ daemonize() [1/2]

bool fawkes::runtime::InitOptions::daemonize ( ) const

Check if daemonization has been requested.

Returns
true if daemonization has been requested, false otherwise

Definition at line 743 of file init_options.cpp.

Referenced by daemonize().

◆ daemonize() [2/2]

InitOptions & fawkes::runtime::InitOptions::daemonize ( bool  daemonize,
bool  kill = false,
bool  status = false,
const char *  pid_file = 0 
)

Set daemonization options.

Parameters
daemonizedaemonization requested
killkill a running daemon
statusprint status about running daemon
pid_filepath to file to write PID to
Returns
reference to this instance

Definition at line 431 of file init_options.cpp.

References daemonize().

◆ daemonize_kill()

bool fawkes::runtime::InitOptions::daemonize_kill ( ) const

Check if killing of daemon has been requested.

Returns
true if killing of daemon has been requested, false otherwise

Definition at line 752 of file init_options.cpp.

◆ daemonize_status()

bool fawkes::runtime::InitOptions::daemonize_status ( ) const

Check if status of daemon has been requested.

Returns
true if status of daemon has been requested, false otherwise

Definition at line 761 of file init_options.cpp.

◆ default_plugin() [1/2]

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.

Returns
default plugin name

Definition at line 617 of file init_options.cpp.

Referenced by default_plugin().

◆ default_plugin() [2/2]

InitOptions & fawkes::runtime::InitOptions::default_plugin ( const char *  default_plugin)

Set additional default plugin name.

Parameters
default_pluginadditional default plugin name
Returns
reference to this instance

Definition at line 386 of file init_options.cpp.

References default_plugin().

Referenced by NaoFawkesModule::NaoFawkesModule().

◆ default_signal_handlers() [1/2]

bool fawkes::runtime::InitOptions::default_signal_handlers ( ) const

Check if default signal handlers should be enabled.

Returns
true if default signal handlers have been requested, false otherwise

Definition at line 734 of file init_options.cpp.

◆ default_signal_handlers() [2/2]

InitOptions & fawkes::runtime::InitOptions::default_signal_handlers ( bool  enable)

Set default signal handlers.

Parameters
enabletrue 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.
Returns
reference to this instance

Definition at line 594 of file init_options.cpp.

◆ group()

InitOptions & fawkes::runtime::InitOptions::group ( const char *  groupname)

Set group name to run as.

Parameters
groupnameuser name to run as
Returns
reference to this instance

Definition at line 535 of file init_options.cpp.

References groupname().

◆ groupname()

const char * fawkes::runtime::InitOptions::groupname ( ) const

Get group name to run as.

Returns
group name to run as

Definition at line 806 of file init_options.cpp.

Referenced by group().

◆ has_groupname()

bool fawkes::runtime::InitOptions::has_groupname ( ) const

Check if group name has been passed.

Returns
true if the parameter has been set, false otherwise

Definition at line 797 of file init_options.cpp.

◆ has_load_plugin_list()

bool fawkes::runtime::InitOptions::has_load_plugin_list ( ) const

Check if plugin load list has been set.

Returns
true if the parameter has been set, false otherwise

Definition at line 662 of file init_options.cpp.

◆ has_loggers()

bool fawkes::runtime::InitOptions::has_loggers ( ) const

Check if logger string has been passed.

Returns
true if the parameter has been set, false otherwise

Definition at line 680 of file init_options.cpp.

◆ has_net_service_name()

bool fawkes::runtime::InitOptions::has_net_service_name ( ) const

Check if network service name has been passed.

Returns
true if the parameter has been set, false otherwise

Definition at line 644 of file init_options.cpp.

◆ has_net_tcp_port()

bool fawkes::runtime::InitOptions::has_net_tcp_port ( ) const

Check if TCP port has been passed.

Returns
true if the parameter has been set, false otherwise

Definition at line 626 of file init_options.cpp.

◆ has_username()

bool fawkes::runtime::InitOptions::has_username ( ) const

Check if user name has been passed.

Returns
true if the parameter has been set, false otherwise

Definition at line 779 of file init_options.cpp.

◆ init_plugin_cache() [1/2]

bool fawkes::runtime::InitOptions::init_plugin_cache ( ) const

Check if plugin cache initialization has been requested.

Returns
true if plugin cache initialization has been requested, false otherwise

Definition at line 725 of file init_options.cpp.

◆ init_plugin_cache() [2/2]

InitOptions & fawkes::runtime::InitOptions::init_plugin_cache ( bool  init_cache)

Enable or disable plugin cache initialization.

Parameters
init_cachetrue to trigger plugin cache initialization, false to disable
Returns
reference to this instance

Definition at line 487 of file init_options.cpp.

◆ load_plugin_list()

const char * fawkes::runtime::InitOptions::load_plugin_list ( ) const

Get plugin load list.

Returns
plugin load list

Definition at line 671 of file init_options.cpp.

◆ load_plugins()

InitOptions & fawkes::runtime::InitOptions::load_plugins ( const char *  plugin_list)

Set list of plugins to load during startup.

Parameters
plugin_listcomma-separated list of names of plugins to load
Returns
reference to this instance

Definition at line 516 of file init_options.cpp.

Referenced by NaoFawkesModule::NaoFawkesModule().

◆ log_level() [1/2]

Logger::LogLevel fawkes::runtime::InitOptions::log_level ( ) const

Get log level.

Returns
log level

Definition at line 698 of file init_options.cpp.

Referenced by log_level().

◆ log_level() [2/2]

InitOptions & fawkes::runtime::InitOptions::log_level ( Logger::LogLevel  log_level)

Set log level.

Parameters
log_leveldesired log level
Returns
reference to this instance

Definition at line 465 of file init_options.cpp.

References log_level().

◆ loggers() [1/2]

const char * fawkes::runtime::InitOptions::loggers ( ) const

Get logger string.

Returns
logger stirng

Definition at line 689 of file init_options.cpp.

Referenced by loggers().

◆ loggers() [2/2]

InitOptions & fawkes::runtime::InitOptions::loggers ( const char *  loggers)

Set loggers.

Parameters
loggersstring of loggers
Returns
reference to this instance

Definition at line 447 of file init_options.cpp.

References loggers().

Referenced by NaoFawkesModule::NaoFawkesModule().

◆ net_service_name() [1/2]

const char * fawkes::runtime::InitOptions::net_service_name ( ) const

Get network service name.

Returns
network service name

Definition at line 653 of file init_options.cpp.

◆ net_service_name() [2/2]

InitOptions & fawkes::runtime::InitOptions::net_service_name ( const char *  service_name)

Set Fawkes network service name.

Parameters
service_nameservice name
Returns
reference to this instance

Definition at line 410 of file init_options.cpp.

Referenced by NaoFawkesModule::NaoFawkesModule().

◆ net_tcp_port() [1/2]

unsigned short int fawkes::runtime::InitOptions::net_tcp_port ( ) const

Get Fawkes network TCP port.

Returns
Fawkes network TCP port

Definition at line 635 of file init_options.cpp.

◆ net_tcp_port() [2/2]

InitOptions & fawkes::runtime::InitOptions::net_tcp_port ( unsigned short int  port)

Set Fawkes network TCP port.

Parameters
portTCP port
Returns
reference to this instance

Definition at line 398 of file init_options.cpp.

◆ operator=()

InitOptions & fawkes::runtime::InitOptions::operator= ( const InitOptions options)

Assignment operator.

Parameters
optionsoptions object to copy
Returns
reference to this instance

Definition at line 290 of file init_options.cpp.

◆ plugin_module_flags() [1/2]

Module::ModuleFlags fawkes::runtime::InitOptions::plugin_module_flags ( ) const

Get plugin module flags.

Returns
plugin module flags

Definition at line 824 of file init_options.cpp.

◆ plugin_module_flags() [2/2]

InitOptions & fawkes::runtime::InitOptions::plugin_module_flags ( Module::ModuleFlags  flags)

Set module flags.

Parameters
flagsflags to open plugin modules with
Returns
reference to this instance

Definition at line 581 of file init_options.cpp.

Referenced by NaoFawkesModule::NaoFawkesModule().

◆ show_help() [1/2]

bool fawkes::runtime::InitOptions::show_help ( ) const

Check if help has been requested.

Returns
true if help has been requested, false otherwise

Definition at line 707 of file init_options.cpp.

Referenced by show_help().

◆ show_help() [2/2]

InitOptions & fawkes::runtime::InitOptions::show_help ( bool  show_help)

Set to show help.

Parameters
show_helptrue to request showing help information, false otherwise
Returns
reference to this instance

Definition at line 476 of file init_options.cpp.

References show_help().

◆ user()

InitOptions & fawkes::runtime::InitOptions::user ( const char *  username)

Set user name to run as.

Parameters
usernameuser name to run as
Returns
reference to this instance

Definition at line 498 of file init_options.cpp.

References username().

◆ username()

const char * fawkes::runtime::InitOptions::username ( ) const

Get user name to run as.

Returns
user name to run as

Definition at line 788 of file init_options.cpp.

Referenced by user().


The documentation for this class was generated from the following files: