Open Lighting Architecture
0.9.0
|
Functions called during program startup.
Programs using the OLA libraries should call either ServerInit() or AppInit(). There are also extra functions to help with installing signal handlers and daemonizing a process.
Files | |
file | Init.cpp |
file | Init.h |
Functions called during program startup. |
Functions | |
bool | ola::ServerInit (int argc, char *argv[], ExportMap *export_map) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map. | |
bool | ola::ServerInit (int *argc, char *argv[], ExportMap *export_map, const std::string &first_line, const std::string &description) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map. Also sets the help string for the program, parses flags and initialises logging from flags. | |
bool | ola::AppInit (int *argc, char *argv[], const std::string &first_line, const std::string &description) |
Used to initialize a application. Installs the SEGV handler and initializes the random number generator, sets the help string for the program, parses flags and initialises logging from flags. | |
bool | ola::InstallSignal (int signal, void(*fp)(int signo)) |
Install a signal handler. | |
bool | ola::InstallSEGVHandler () |
Install signal handlers to deal with SIGBUS & SIGSEGV. | |
void | ola::InitExportMap (int argc, char *argv[], ExportMap *export_map) |
Populate the ExportMap with a couple of basic variables. | |
void | ola::Daemonise () |
Run as a daemon. |
bool ola::AppInit | ( | int * | argc, |
char * | argv[], | ||
const std::string & | first_line, | ||
const std::string & | description | ||
) |
Used to initialize a application. Installs the SEGV handler and initializes the random number generator, sets the help string for the program, parses flags and initialises logging from flags.
argc | argument count |
argv | pointer to the argument strings |
first_line | the inital line that is displayed in the help section. This is displayed after argv[0]. |
description | a multiline description of the program |
void ola::Daemonise | ( | ) |
Run as a daemon.
Daemonize logs messages if it fails, so it's best to initialize the logging system (ola::InitLogging) before calling. However Daemonize() closes all open file descriptors so stdout/stderr will point to /dev/null in the daemon process. Therefore daemons should always use syslog logging.
If we can't daemonize the process is terminated.
See logging.
void ola::InitExportMap | ( | int | argc, |
char * | argv[], | ||
ExportMap * | export_map | ||
) |
Populate the ExportMap with a couple of basic variables.
argc | argument count |
argv | pointer to the arugment strings |
export_map | ExportMap to populate |
This is called by ServerInit(). It sets the following variables:
bool ola::InstallSEGVHandler | ( | ) |
Install signal handlers to deal with SIGBUS & SIGSEGV.
On receiving a SIGBUS or SIGSEGV a stack trace will be printed.
bool ola::InstallSignal | ( | int | signal, |
void(*)(int signo) | fp | ||
) |
Install a signal handler.
signal | the signal number to catch |
fp | is a function pointer to the handler |
bool ola::ServerInit | ( | int | argc, |
char * | argv[], | ||
ExportMap * | export_map | ||
) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map.
argc | argument count |
argv | pointer to argument strings |
export_map | an optional pointer to an ExportMap |
bool ola::ServerInit | ( | int * | argc, |
char * | argv[], | ||
ExportMap * | export_map, | ||
const std::string & | first_line, | ||
const std::string & | description | ||
) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map. Also sets the help string for the program, parses flags and initialises logging from flags.
argc | argument count |
argv | pointer to argument strings |
export_map | an optional pointer to an ExportMap |
first_line | the inital line that is displayed in the help section. This is displayed after argv[0]. |
description | a multiline description of the program |