LLApp Class Reference

#include <llapp.h>

Inheritance diagram for LLApp:

Inheritance graph
[legend]
Collaboration diagram for LLApp:

Collaboration graph
[legend]

List of all members.

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 ()
LLRunnergetRunner ()
 Get a reference to the application runner.

Static Public Member Functions

static LLAppinstance ()
 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 LLAtomicU32sSigChildCount = 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

LLErrorThreadmThreadErrorp
LLRunner mRunner
Runtime option implementation


LLSD mOptions

Static Private Attributes

static LLAppErrorHandler sErrorHandler = NULL
static LLAppErrorHandler sSyncErrorHandler = NULL
static LLAppsApplication = NULL

Friends

class LLErrorThread
void default_unix_signal_handler (int signum, siginfo_t *info, void *)


Detailed Description

Definition at line 64 of file llapp.h.


Member Typedef Documentation

typedef std::map<std::string, std::string> LLApp::string_map

Definition at line 226 of file llapp.h.

typedef std::map<pid_t, LLChildInfo> LLApp::child_map [protected]

Definition at line 237 of file llapp.h.

typedef int(* LLApp::signal_handler_func)(int signum) [private]


Member Enumeration Documentation

Enumerator:
APP_STATUS_RUNNING 
APP_STATUS_QUITTING 
APP_STATUS_STOPPED 
APP_STATUS_ERROR 

Definition at line 68 of file llapp.h.

Enumeration to specify option priorities in highest to lowest order.

Enumerator:
PRIORITY_RUNTIME_OVERRIDE 
PRIORITY_COMMAND_LINE 
PRIORITY_SPECIFIC_CONFIGURATION 
PRIORITY_GENERAL_CONFIGURATION 
PRIORITY_DEFAULT 
PRIORITY_COUNT 

Definition at line 91 of file llapp.h.


Constructor & Destructor Documentation

LLApp::LLApp (  ) 

LLApp::~LLApp (  )  [virtual]

Definition at line 124 of file llapp.cpp.

References LLCommon::cleanupClass(), ms_sleep(), mThreadErrorp, NULL, setStopped(), and sSigChildCount.

Here is the call graph for this function:


Member Function Documentation

LLApp * LLApp::instance (  )  [static]

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.

Parameters:
name The name of the option.
Returns:
Returns the option data.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
argc The argc passed into main().
argv The argv passed into main().
Returns:
Returns true if the parse succeeded.

Definition at line 162 of file llapp.cpp.

References LLSD::assign(), llendl, llinfos, PRIORITY_COMMAND_LINE, and setOptionData().

Referenced by main(), and WinMain().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
level The priority level of the data.
data The data to set.
Returns:
Returns true if the option was 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().

Here is the call graph for this function:

Here is the caller graph for this function:

LLSD LLApp::getOptionData ( OptionPriority  level  ) 

Get the option data at the specified priority.

This method is probably not so useful except when merging information.

Parameters:
level The priority level of the data.
Returns:
Returns The data (if any) at the level priority.

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().

Here is the caller graph for this function:

virtual bool LLApp::init (  )  [pure virtual]

virtual bool LLApp::cleanup (  )  [pure virtual]

virtual bool LLApp::mainLoop (  )  [pure virtual]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLApp::setStopped (  )  [static]

Definition at line 340 of file llapp.cpp.

References APP_STATUS_STOPPED, and setStatus().

Referenced by runErrorHandler(), and ~LLApp().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

bool LLApp::isRunning (  )  [static]

Definition at line 354 of file llapp.cpp.

References APP_STATUS_RUNNING, and sStatus.

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

U32 LLApp::getSigChildCount (  )  [static]

Definition at line 380 of file llapp.cpp.

References sSigChildCount.

Referenced by LLErrorThread::run().

Here is the caller graph for this function:

void LLApp::incSigChildCount (  )  [static]

Definition at line 390 of file llapp.cpp.

References sSigChildCount.

Referenced by default_unix_signal_handler().

Here is the caller graph for this function:

int LLApp::getPid (  )  [static]

Definition at line 402 of file llapp.cpp.

void LLApp::setErrorHandler ( LLAppErrorHandler  handler  ) 

Definition at line 274 of file llapp.cpp.

Referenced by main(), and WINMAIN().

Here is the caller graph for this function:

void LLApp::setSyncErrorHandler ( LLAppErrorHandler  handler  ) 

Definition at line 280 of file llapp.cpp.

Referenced by main().

Here is the caller graph for this function:

void LLApp::setChildCallback ( pid_t  pid,
LLAppChildCallback  callback 
)

LL_WINDOWS.

Definition at line 481 of file llapp.cpp.

References LLChildInfo::mCallback.

void LLApp::setDefaultChildCallback ( LLAppChildCallback  callback  ) 

Definition at line 488 of file llapp.cpp.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
Returns the application runner. Do not save the pointer past the caller's stack frame.

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLApp::runErrorHandler (  )  [static, private]

Definition at line 295 of file llapp.cpp.

References sErrorHandler, and setStopped().

Referenced by LLErrorThread::run().

Here is the call graph for this function:

Here is the caller graph for this function:

void LLApp::runSyncErrorHandler (  )  [static, private]

Definition at line 286 of file llapp.cpp.

References sSyncErrorHandler.

Referenced by setError().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class LLErrorThread [friend]

Definition at line 66 of file llapp.h.

Referenced by setupErrorHandling().

void default_unix_signal_handler ( int  signum,
siginfo_t *  info,
void *   
) [friend]

Referenced by setup_signals().


Member Data Documentation

Definition at line 227 of file llapp.h.

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]

Definition at line 233 of file llapp.h.

Referenced by LLErrorThread::run().

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]

Definition at line 238 of file llapp.h.

Referenced by LLErrorThread::run().

Definition at line 239 of file llapp.h.

Referenced by LLErrorThread::run().

LLAppErrorHandler LLApp::sErrorHandler = NULL [static, private]

Definition at line 257 of file llapp.h.

Referenced by runErrorHandler().

LLAppErrorHandler LLApp::sSyncErrorHandler = NULL [static, private]

Definition at line 258 of file llapp.h.

Referenced by runSyncErrorHandler().

Definition at line 261 of file llapp.h.

Referenced by setupErrorHandling(), and ~LLApp().

Definition at line 264 of file llapp.h.

Referenced by getRunner(), and stepFrame().

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]

Definition at line 276 of file llapp.h.

Referenced by instance(), and LLApp().

BOOL LLApp::sLogInSignal = FALSE [static]

Definition at line 284 of file llapp.h.

Referenced by LLErrorThread::run().


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

Generated on Fri May 16 08:38:58 2008 for SecondLife by  doxygen 1.5.5