#include <llapp.h>
Runtime options | |
enum | OptionPriority { PRIORITY_RUNTIME_OVERRIDE, PRIORITY_COMMAND_LINE, PRIORITY_SPECIFIC_CONFIGURATION, PRIORITY_GENERAL_CONFIGURATION, PRIORITY_DEFAULT, PRIORITY_COUNT } |
Enumeration to specify option priorities in highest to lowest order. More... | |
LLSD | getOption (const std::string &name) const |
Get the application option at the highest priority. | |
bool | parseCommandOptions (int argc, char **argv) |
Parse command line options and insert them into application command line options. | |
bool | setOptionData (OptionPriority level, LLSD data) |
Set the options at the specified priority. | |
LLSD | getOptionData (OptionPriority level) |
Get the option data at the specified priority. | |
Public Types | |
enum | e_app_status { APP_STATUS_RUNNING, APP_STATUS_QUITTING, APP_STATUS_STOPPED, APP_STATUS_ERROR } |
typedef enum LLApp::e_app_status | EAppStatus |
typedef std::map< std::string, std::string > | string_map |
Public Member Functions | |
LLApp () | |
virtual | ~LLApp () |
virtual bool | init ()=0 |
virtual bool | cleanup ()=0 |
virtual bool | mainLoop ()=0 |
void | setErrorHandler (LLAppErrorHandler handler) |
void | setSyncErrorHandler (LLAppErrorHandler handler) |
void | setChildCallback (pid_t pid, LLAppChildCallback callback) |
LL_WINDOWS. | |
void | setDefaultChildCallback (LLAppChildCallback callback) |
pid_t | fork () |
LLRunner & | getRunner () |
Get a reference to the application runner. | |
Static Public Member Functions | |
static LLApp * | instance () |
Return the static app instance if one was created. | |
static void | setQuitting () |
static void | setStopped () |
static void | setError () |
static bool | isStopped () |
static bool | isRunning () |
static bool | isQuitting () |
static bool | isError () |
static bool | isExiting () |
static U32 | getSigChildCount () |
static void | incSigChildCount () |
static int | getPid () |
Public Attributes | |
string_map | mOptionMap |
Static Public Attributes | |
static BOOL | sLogInSignal = FALSE |
Protected Types | |
typedef std::map< pid_t, LLChildInfo > | child_map |
Protected Member Functions | |
void | stepFrame () |
This method is called once a frame to do once a frame tasks. | |
Static Protected Member Functions | |
static void | setStatus (EAppStatus status) |
Static Protected Attributes | |
static EAppStatus | sStatus = LLApp::APP_STATUS_STOPPED |
static BOOL | sErrorThreadRunning = FALSE |
static LLAtomicU32 * | sSigChildCount = NULL |
static child_map | sChildMap |
static LLAppChildCallback | sDefaultChildCallback = NULL |
Private Types | |
typedef int(* | signal_handler_func )(int signum) |
Private Member Functions | |
void | setupErrorHandling () |
Static Private Member Functions | |
static void | runErrorHandler () |
static void | runSyncErrorHandler () |
Private Attributes | |
LLErrorThread * | mThreadErrorp |
LLRunner | mRunner |
Runtime option implementation | |
LLSD | mOptions |
Static Private Attributes | |
static LLAppErrorHandler | sErrorHandler = NULL |
static LLAppErrorHandler | sSyncErrorHandler = NULL |
static LLApp * | sApplication = NULL |
Friends | |
class | LLErrorThread |
void | default_unix_signal_handler (int signum, siginfo_t *info, void *) |
Definition at line 64 of file llapp.h.
typedef enum LLApp::e_app_status LLApp::EAppStatus |
typedef std::map<std::string, std::string> LLApp::string_map |
typedef std::map<pid_t, LLChildInfo> LLApp::child_map [protected] |
typedef int(* LLApp::signal_handler_func)(int signum) [private] |
enum LLApp::e_app_status |
LLApp::LLApp | ( | ) |
Definition at line 90 of file llapp.cpp.
References APP_STATUS_RUNNING, LLSD::append(), LLSD::emptyArray(), i, LLCommon::initClass(), mOptions, PRIORITY_COUNT, sApplication, tut::sd(), setStatus(), setupErrorHandling(), and sSigChildCount.
LLApp::~LLApp | ( | ) | [virtual] |
Definition at line 124 of file llapp.cpp.
References LLCommon::cleanupClass(), ms_sleep(), mThreadErrorp, NULL, setStopped(), and sSigChildCount.
LLApp * LLApp::instance | ( | ) | [static] |
Return the static app instance if one was created.
Reimplemented in LLAppViewer.
Definition at line 143 of file llapp.cpp.
References sApplication.
Referenced by LLServiceBuilder::buildServiceURI(), LLHTTPConfigRuntimeSingleService::del(), LLHTTPLiveConfigSingleService::get(), LLHTTPLiveConfigService::get(), LLHTTPConfigPriorityService< PRIORITY >::get(), LLHTTPConfigRuntimeSingleService::get(), LLHTTPConfigRuntimeService::get(), LLHTTPConfigService::get(), get_shared_secret(), handle_button_click(), LLError::initForServer(), LLHTTPConfigRuntimeService::post(), LLHTTPConfigRuntimeSingleService::put(), LLHTTPLiveConfigSingleService::validate(), and LLHTTPConfigRuntimeSingleService::validate().
LLSD LLApp::getOption | ( | const std::string & | name | ) | const |
Get the application option at the highest priority.
If the return value is undefined, the option does not exist.
name | The name of the option. |
Definition at line 149 of file llapp.cpp.
References LLSD::beginArray(), LLSD::endArray(), LLSD::isDefined(), and mOptions.
Referenced by LLServiceBuilder::buildServiceURI(), get_shared_secret(), LLCrashLogger::init(), LLError::initForServer(), LLLogImpl::log(), LLLogImpl::useLegacyLogMessage(), and LLHTTPLiveConfigSingleService::validate().
bool LLApp::parseCommandOptions | ( | int | argc, | |
char ** | argv | |||
) |
Parse command line options and insert them into application command line options.
The name inserted into the option will have leading option identifiers (a minus or double minus) stripped. All options with values will be stored as a string, while all options without values will be stored as true.
Definition at line 162 of file llapp.cpp.
References LLSD::assign(), llendl, llinfos, PRIORITY_COMMAND_LINE, and setOptionData().
Referenced by main(), and WinMain().
bool LLApp::setOptionData | ( | OptionPriority | level, | |
LLSD | data | |||
) |
Set the options at the specified priority.
This function completely replaces the options at the priority level with the data specified. This function will make sure level and data might be valid before doing the replace.
level | The priority level of the data. | |
data | The data to set. |
Definition at line 203 of file llapp.cpp.
References mOptions, PRIORITY_COUNT, LLSD::type(), and LLSD::TypeMap.
Referenced by LLHTTPConfigRuntimeSingleService::del(), LLLiveAppConfig::loadFile(), parseCommandOptions(), LLHTTPConfigRuntimeService::post(), and LLHTTPConfigRuntimeSingleService::put().
LLSD LLApp::getOptionData | ( | OptionPriority | level | ) |
Get the option data at the specified priority.
This method is probably not so useful except when merging information.
level | The priority level of the data. |
Definition at line 215 of file llapp.cpp.
References mOptions, and PRIORITY_COUNT.
Referenced by LLHTTPConfigRuntimeSingleService::del(), LLHTTPLiveConfigService::get(), LLHTTPConfigRuntimeSingleService::get(), LLHTTPConfigRuntimeService::get(), LLHTTPConfigService::get(), LLHTTPConfigRuntimeService::post(), LLHTTPConfigRuntimeSingleService::put(), and LLHTTPConfigRuntimeSingleService::validate().
virtual bool LLApp::init | ( | ) | [pure virtual] |
Implemented in LLCrashLogger, LLCrashLoggerMac, LLAppViewer, LLAppViewerLinux, LLAppViewerMacOSX, LLAppViewerWin32, tut::application::LLTestApp, and LLCrashLoggerWindows.
virtual bool LLApp::cleanup | ( | ) | [pure virtual] |
Implemented in LLCrashLogger, LLCrashLoggerMac, LLAppViewer, LLAppViewerWin32, tut::application::LLTestApp, and LLCrashLoggerWindows.
virtual bool LLApp::mainLoop | ( | ) | [pure virtual] |
Implemented in LLCrashLoggerLinux, LLCrashLogger, LLCrashLoggerText, LLCrashLoggerMac, LLAppViewer, tut::application::LLTestApp, and LLCrashLoggerWindows.
void LLApp::setQuitting | ( | ) | [static] |
Definition at line 328 of file llapp.cpp.
References APP_STATUS_QUITTING, isExiting(), llendl, llinfos, and setStatus().
Referenced by default_unix_signal_handler(), LLAppViewer::forceQuit(), handle_button_click(), and WndProc().
void LLApp::setStopped | ( | ) | [static] |
Definition at line 340 of file llapp.cpp.
References APP_STATUS_STOPPED, and setStatus().
Referenced by runErrorHandler(), and ~LLApp().
void LLApp::setError | ( | ) | [static] |
Definition at line 315 of file llapp.cpp.
References APP_STATUS_ERROR, isError(), runSyncErrorHandler(), and setStatus().
Referenced by default_unix_signal_handler(), and viewer_windows_exception_handler().
bool LLApp::isStopped | ( | ) | [static] |
Definition at line 347 of file llapp.cpp.
References APP_STATUS_STOPPED, and sStatus.
Referenced by default_unix_signal_handler(), LLErrorThread::run(), and viewer_windows_exception_handler().
bool LLApp::isRunning | ( | ) | [static] |
bool LLApp::isQuitting | ( | ) | [static] |
Definition at line 368 of file llapp.cpp.
References APP_STATUS_QUITTING, and sStatus.
Referenced by default_unix_signal_handler(), isExiting(), main(), LLCrashLoggerWindows::mainLoop(), WinMain(), and WINMAIN().
bool LLApp::isError | ( | ) | [static] |
Definition at line 361 of file llapp.cpp.
References APP_STATUS_ERROR, and sStatus.
Referenced by default_unix_signal_handler(), isExiting(), main(), LLErrorThread::run(), setError(), viewer_windows_exception_handler(), WinMain(), and WINMAIN().
bool LLApp::isExiting | ( | ) | [static] |
Definition at line 373 of file llapp.cpp.
References isError(), and isQuitting().
Referenced by LLFloaterTools::canClose(), LLFloaterMap::canClose(), display(), LLViewerWindow::handleActivate(), LLAppViewer::mainLoop(), LLVOAvatar::onCustomizeEnd(), LLViewerWindow::reshape(), setQuitting(), and use_circuit_callback().
U32 LLApp::getSigChildCount | ( | ) | [static] |
Definition at line 380 of file llapp.cpp.
References sSigChildCount.
Referenced by LLErrorThread::run().
void LLApp::incSigChildCount | ( | ) | [static] |
Definition at line 390 of file llapp.cpp.
References sSigChildCount.
Referenced by default_unix_signal_handler().
void LLApp::setErrorHandler | ( | LLAppErrorHandler | handler | ) |
void LLApp::setSyncErrorHandler | ( | LLAppErrorHandler | handler | ) |
void LLApp::setChildCallback | ( | pid_t | pid, | |
LLAppChildCallback | callback | |||
) |
void LLApp::setDefaultChildCallback | ( | LLAppChildCallback | callback | ) |
pid_t LLApp::fork | ( | ) |
Definition at line 493 of file llapp.cpp.
References llendl, llinfos, llwarns, ms_sleep(), and setupErrorHandling().
Referenced by LLAppViewerLinux::handleCrashReporting(), and LLAppViewer::initConfiguration().
LLRunner& LLApp::getRunner | ( | ) | [inline] |
Get a reference to the application runner.
Please use the runner with caution. Since the Runner usage pattern is not yet clear, this method just gives access to it to add and remove runnables.
Definition at line 223 of file llapp.h.
References mRunner.
void LLApp::setStatus | ( | EAppStatus | status | ) | [static, protected] |
Definition at line 308 of file llapp.cpp.
References sStatus.
Referenced by LLApp(), setError(), setQuitting(), and setStopped().
void LLApp::stepFrame | ( | ) | [protected] |
This method is called once a frame to do once a frame tasks.
Definition at line 224 of file llapp.cpp.
References mRunner, LLRunner::run(), LLEventTimer::updateClass(), and LLFrameTimer::updateFrameTime().
void LLApp::setupErrorHandling | ( | ) | [private] |
Definition at line 232 of file llapp.cpp.
References llendl, LLErrorThread, llinfos, mThreadErrorp, setup_signals(), LLErrorThread::setUserData(), LLThread::start(), and TRUE.
Referenced by fork(), and LLApp().
void LLApp::runErrorHandler | ( | ) | [static, private] |
Definition at line 295 of file llapp.cpp.
References sErrorHandler, and setStopped().
Referenced by LLErrorThread::run().
void LLApp::runSyncErrorHandler | ( | ) | [static, private] |
Definition at line 286 of file llapp.cpp.
References sSyncErrorHandler.
Referenced by setError().
friend class LLErrorThread [friend] |
void default_unix_signal_handler | ( | int | signum, | |
siginfo_t * | info, | |||
void * | ||||
) | [friend] |
Referenced by setup_signals().
LLApp::EAppStatus LLApp::sStatus = LLApp::APP_STATUS_STOPPED [static, protected] |
Definition at line 232 of file llapp.h.
Referenced by isError(), isQuitting(), isRunning(), isStopped(), and setStatus().
BOOL LLApp::sErrorThreadRunning = FALSE [static, protected] |
LLAtomicU32 * LLApp::sSigChildCount = NULL [static, protected] |
Definition at line 236 of file llapp.h.
Referenced by getSigChildCount(), incSigChildCount(), LLApp(), and ~LLApp().
LLApp::child_map LLApp::sChildMap [static, protected] |
LLAppChildCallback LLApp::sDefaultChildCallback = NULL [static, protected] |
LLAppErrorHandler LLApp::sErrorHandler = NULL [static, private] |
LLAppErrorHandler LLApp::sSyncErrorHandler = NULL [static, private] |
LLErrorThread* LLApp::mThreadErrorp [private] |
LLRunner LLApp::mRunner [private] |
LLSD LLApp::mOptions [private] |
Definition at line 270 of file llapp.h.
Referenced by getOption(), getOptionData(), LLApp(), and setOptionData().
LLApp * LLApp::sApplication = NULL [static, private] |
BOOL LLApp::sLogInSignal = FALSE [static] |