My Project
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CParaEngineService Class Reference

this allows ParaEngine to operate as a system service without GUI, such as in server mode. More...

#include <ParaEngineService.h>

Public Member Functions

int Run (const char *pCommandLine=NULL, CParaEngineApp *pApp=NULL)
 this function does not return util service is stopped. More...
 
void StopService ()
 stop the service
 
void AcceptKeyStroke (bool bAccept=true)
 whether we will accept key stroke. More...
 
bool IsAcceptKeyStroke ()
 whether we will accept key stroke
 

Static Public Member Functions

static void Signal_Handler (int sig)
 
static void InitDaemon (void)
 call this function before calling Run() to run as a linux daemon More...
 

Protected Types

typedef basic_waitable_timer< boost::chrono::steady_clock > timer_type
 the main timer that ticks 30 times a second
 

Protected Member Functions

void handle_timeout (const boost::system::error_code &err)
 the main timer time out. More...
 

Protected Attributes

boost::asio::io_service m_main_io_service
 the main loop
 
boost::scoped_ptr< boost::asio::io_service::work > m_work_lifetime
 Work for the private m_io_service_dispatcher to perform. More...
 
timer_type m_main_timer
 

Detailed Description

this allows ParaEngine to operate as a system service without GUI, such as in server mode.

normally, one should use CParaEngineApp, which is the stand ParaEngine Application with 3D graphics.

Note
: this class is cross platform.

Member Function Documentation

§ AcceptKeyStroke()

void CParaEngineService::AcceptKeyStroke ( bool  bAccept = true)

whether we will accept key stroke.

such as the "ENTER" key will terminate the program.

§ handle_timeout()

void CParaEngineService::handle_timeout ( const boost::system::error_code &  err)
protected

the main timer time out.

§ InitDaemon()

void CParaEngineService::InitDaemon ( void  )
static

call this function before calling Run() to run as a linux daemon

now entering daemon code, Be as verbose as possible when writing either to the syslog or your own logs. Debugging a daemon can be quite difficult when there isn't enough information available as to the status of the daemon.

§ Run()

int CParaEngineService::Run ( const char *  pCommandLine = NULL,
CParaEngineApp pApp = NULL 
)

this function does not return util service is stopped.

Parameters
pCommandLinethe command line.
pAppif NULL, a new app is created.
Returns
the exit code.

Member Data Documentation

§ m_work_lifetime

boost::scoped_ptr<boost::asio::io_service::work> ParaEngine::CParaEngineService::m_work_lifetime
protected

Work for the private m_io_service_dispatcher to perform.

If we do not give the io_service some work to do then the io_service::run() function will exit immediately.


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