Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

P::SimpleApp Class Reference
[Core library]

A simple application base class. More...

#include <psimpleapp.h>

Inheritance diagram for P::SimpleApp:

P::ServerApp List of all members.

Public Member Functions

 SimpleApp (const AboutData &about)
 Simple application constructor.

virtual ~SimpleApp ()
int run (int argc, char *argv[])
 Init & run the application.

void stop (int code)
 Stop the application.

virtual void terminate (int signal)
 Terminate application on signal.

const AboutDataabout () const throw ()
 Returns a reference to the about data.


Protected Member Functions

virtual int init (int argc, char *argv[])
 Application init.

virtual int main ()
 Application main loop.

virtual void cleanup ()
 Application cleanup function.

SemaphoreexitSem ()
 Returns a reference to the exit-semaphore.

int exitCode () const
 Returns the application's exit code.


Static Protected Member Functions

RETSIGTYPE SIGTERM_handler (int)
 Process termination signal handler.


Friends

PCORE_EXPORT friend SimpleApptheApp () throw ()
 Returns a pointer to the application object.


Detailed Description

A simple application base class.

Author:
Christian Prochnow <cproch@seculogix.de>

Definition at line 55 of file psimpleapp.h.


Constructor & Destructor Documentation

P::SimpleApp::SimpleApp const AboutData about  ) 
 

Simple application constructor.

Simple application constructor.

Parameters:
about A reference to the applications about data.

virtual P::SimpleApp::~SimpleApp  )  [virtual]
 


Member Function Documentation

const AboutData& P::SimpleApp::about  )  const throw () [inline]
 

Returns a reference to the about data.

Definition at line 87 of file psimpleapp.h.

virtual void P::SimpleApp::cleanup  )  [inline, protected, virtual]
 

Application cleanup function.

Implement this method for cleaning up the application before exiting it.

Definition at line 119 of file psimpleapp.h.

int P::SimpleApp::exitCode  )  const [inline, protected]
 

Returns the application's exit code.

Definition at line 129 of file psimpleapp.h.

Semaphore& P::SimpleApp::exitSem  )  [inline, protected]
 

Returns a reference to the exit-semaphore.

Definition at line 125 of file psimpleapp.h.

virtual int P::SimpleApp::init int  argc,
char *  argv[]
[protected, virtual]
 

Application init.

Overload this method to implement application initialization. Remember to call the default implementation to initialize the process signal handlers.

Returns:
returns zero if initialization was successfull, otherwise the exit code of the application.

Reimplemented in P::ServerApp.

virtual int P::SimpleApp::main  )  [protected, virtual]
 

Application main loop.

Overfload this method to implement the application main-loop. The default implementation does nothing except waiting for the exit semaphore to become increased and will then return with the value given to the stop() method.

Returns:
the applications exit code

int P::SimpleApp::run int  argc,
char *  argv[]
 

Init & run the application.

This method initializes the application by calling init(). When initialization was successfull the main method will be called. Before returning with the app's exit code, cleanup() will be called.

Returns:
the applications exit code, returned by the main() method

RETSIGTYPE P::SimpleApp::SIGTERM_handler int   )  [static, protected]
 

Process termination signal handler.

void P::SimpleApp::stop int  code  ) 
 

Stop the application.

The stop functions increases a semaphore to tell the main-loop that it should exit.

Parameters:
code applications exit code

virtual void P::SimpleApp::terminate int  signal  )  [virtual]
 

Terminate application on signal.


Friends And Related Function Documentation

PCORE_EXPORT friend SimpleApp* theApp  )  throw () [friend]
 

Returns a pointer to the application object.


The documentation for this class was generated from the following file:
Generated on Fri Mar 12 21:08:36 2004 for P::Classes by doxygen 1.3.3