dbp::daemon_application Class Reference

Daemon application class. More...

#include <daemon_application.h>

Inheritance diagram for dbp::daemon_application:
Inheritance graph
[legend]
Collaboration diagram for dbp::daemon_application:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void set_name (const std::string &name)
 Set application name.
virtual void set_description (const std::string &description)
 Set application description.
virtual void register_cmdline_parameter (const cmdline_parameter &param, cmdline_parameter_handler handler)
 Register the application command line parameter.
virtual void on_execute (on_execute_handler handler)
 Register the application main execute cycle handler.
virtual void on_exception (on_exception_handler handler)
 Register the exception handler.
virtual int run (int argc, char *argv[])
 Execute the application.
virtual void log (const std::string &message, log_level::log_level level=log_level::info)
 Write to the system log.
virtual void on_reload_configuration (on_reload_configuration_handler handler)
 Register "reload application configuration" signal handler.
virtual void on_pause (on_pause_handler handler)
 Register "pause" signal handler.
virtual void on_resume (on_resume_handler handler)
 Register "resume" signal handler.
virtual void on_terminate (on_terminate_handler handler)
 Register "terminate" signal handler.

Friends

class singleton< daemon_application >

Detailed Description

Daemon application class.

This class implements daemons (services in Windows terms). These kinds of applications are running transparently in the system.


Member Function Documentation

virtual void dbp::daemon_application::log ( const std::string &  message,
log_level::log_level  level = log_level::info 
) [inline, virtual]

Write to the system log.

Daemon applications should not to display any information to the console, so you should call this method to write any information into the system log.

Parameters:
message the information to log.
level the log level.

Implements dbp::daemon_application_int.

References dbp::daemon_application_int::log().

virtual void dbp::daemon_application::on_execute ( on_execute_handler  handler  )  [inline, virtual]

Register the application main execute cycle handler.

You need to register your own application execution handler with application logic.

See the 'examples/hello_world/console_application' directory for the sample code.

Parameters:
handler an execute command delegate.

Implements dbp::application_int.

References dbp::application_int::on_execute().

virtual void dbp::daemon_application::on_pause ( on_pause_handler  handler  )  [inline, virtual]

Register "pause" signal handler.

The "pause" signal is raised when an user wants to pause the application. If your application should react to pause (by stopping calculations or dropping new connections), you should register your own signal handler.

Parameters:
handler the signal handler delegate

Implements dbp::daemon_application_int.

References dbp::daemon_application_int::on_pause().

virtual void dbp::daemon_application::on_reload_configuration ( on_reload_configuration_handler  handler  )  [inline, virtual]

Register "reload application configuration" signal handler.

If your application implements of on-the-fly reconfiguration, you should register your own signal handler. This signal is raised when an user wants to reload daemon configuration file to apply new configuration parameters.

Parameters:
handler the signal handler delegate

Implements dbp::daemon_application_int.

References dbp::daemon_application_int::on_reload_configuration().

virtual void dbp::daemon_application::on_resume ( on_resume_handler  handler  )  [inline, virtual]

Register "resume" signal handler.

The "resume" signal is raised when an user wants to continue the running of application. If your application should react to resume (by starting calculations or accepting new connections), you should register your own signal handler.

Parameters:
handler the signal handler delegate

Implements dbp::daemon_application_int.

References dbp::daemon_application_int::on_resume().

virtual void dbp::daemon_application::on_terminate ( on_terminate_handler  handler  )  [inline, virtual]

Register "terminate" signal handler.

The "terminate" signal is raised when an user wants to stop the application. If your application should react to terminating (flushing buffers, etc.), you should register your own signal handler.

Parameters:
handler the signal handler delegate

Implements dbp::daemon_application_int.

References dbp::daemon_application_int::on_terminate().

virtual void dbp::daemon_application::register_cmdline_parameter ( const cmdline_parameter param,
cmdline_parameter_handler  handler 
) [inline, virtual]

Register the application command line parameter.

You can register one or more command line parameters supported by your application. When application starts, it checks of command line parameters passed for registered ones. If none is found, it reports about invalid command line parameter; if registered one is found, on_cmdline_parameter handler is called.

See the 'examples/hello_world/console_application' directory for the sample code using this method.

Parameters:
param the command line parameter to register.
handler a command line parameter delegate.

Implements dbp::application_int.

References dbp::application_int::register_cmdline_parameter().

virtual void dbp::daemon_application::set_description ( const std::string &  description  )  [inline, virtual]

Set application description.

Parameters:
description a brief application description for displaying purposes.

Implements dbp::application_int.

References dbp::application_int::set_description().

virtual void dbp::daemon_application::set_name ( const std::string &  name  )  [inline, virtual]

Set application name.

The application name is used for displaying purposes. The internationalization (i18n) resources path (catalog) is also initialized from the application name.

Parameters:
name the name of the application.

Implements dbp::application_int.

References dbp::application_int::set_name().


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

 
Support This Project
SourceForge.net Logo