Application Class Reference

Base class for both server and client application class. More...

#include <application.h>

Inherited by ApplicationClient, and ApplicationServer.

Inheritance diagram for Application:

Inheritance graph
[legend]
Collaboration diagram for Application:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Application ()
virtual ~Application ()=0
virtual void init ()=0
 Inicialization of application.
virtual void run ()=0
virtual void clean ()=0
virtual GamegetGameCommon ()=0
 Get pointer to Game.
virtual CommandergetCommander ()=0
 Provide access to the commander.
virtual TaskManagergetTaskManager ()
 Provide access to task manager.

Protected Member Functions

void loadUserConfigFile (const char *file, const char *file_template)
 Load user config file.
void saveUserConfigFile (const char *file, const char *file_template)

Protected Attributes

TaskManager mTaskManager
 global version of task manager

Private Member Functions

void initBasicSubsystems ()
 Does some basic inicialization.
void cleanBasicSubsystems ()
 Clean what initBasicSubsystems inicialized.

Detailed Description

Base class for both server and client application class.

It serves as some kind of interface. For example if we will need application to provide something to common objects, we may use this. And Martin wished to have this class :-) This is abstract class that can't be created directly. It should only be usede as base class for ApplicationServer and/or ApplicationClient.

Definition at line 31 of file application.h.


Constructor & Destructor Documentation

Application::Application  ) 
 

Definition at line 18 of file application.cpp.

References initBasicSubsystems().

Here is the call graph for this function:

Application::~Application  )  [pure virtual]
 

Definition at line 23 of file application.cpp.

References cleanBasicSubsystems().

Here is the call graph for this function:


Member Function Documentation

virtual void Application::clean  )  [pure virtual]
 

Implemented in ApplicationClient, and ApplicationServer.

void Application::cleanBasicSubsystems  )  [private]
 

Clean what initBasicSubsystems inicialized.

quit SDL.

Definition at line 57 of file application.cpp.

References TIN.

Referenced by ~Application().

virtual Commander& Application::getCommander  )  [pure virtual]
 

Provide access to the commander.

This may be used to push commands to commander anywhere from the code.

Implemented in ApplicationClient, and ApplicationServer.

virtual Game* Application::getGameCommon  )  [pure virtual]
 

Get pointer to Game.

If you are in client or server code use getGame() which return server or client version of Game so you have acces to more features :-) Please never retype this GameClient or GameServer.

Returns:
pointer common game

Implemented in ApplicationClient, and ApplicationServer.

Referenced by World::createProjectile(), World::createTank(), Tank::initSpecific(), and Projectile::initSpecific().

TaskManager & Application::getTaskManager  )  [virtual]
 

Provide access to task manager.

This task manager groups all task that needed to be called periodicaly. So if you have some loop you should call app.getTaskManager().update(); Or if you have you own task manager you may add it as task to your manager.

Definition at line 102 of file application.cpp.

References mTaskManager.

virtual void Application::init  )  [pure virtual]
 

Inicialization of application.

Implemented in ApplicationClient, and ApplicationServer.

Referenced by main().

void Application::initBasicSubsystems  )  [private]
 

Does some basic inicialization.

Loads settings, inicialize loging, inicialize SDL. clean for this inicialization is in cleanBasicSubsystems() Should be called early in application. Better it should be the first executed code - it is called in contructor of Application so it is quite early. It is important becase it sets up loging and loads configuration, co other objects may read variables in contructor from settings.

Definition at line 28 of file application.cpp.

References DIE(), g_settings, g_translator, Settings::getString(), gParams, Params::load(), Translator::loadFile(), Settings::loadSettings(), locateFile(), LOGE, LOGI, MAIN_SETTING_FILE, and TIN.

Referenced by Application().

Here is the call graph for this function:

void Application::loadUserConfigFile const char *  file,
const char *  file_template
[protected]
 

Load user config file.

Create if doesn't exist

Parameters:
file is resolved using g_settings
file_template is resolved using g_settings

Definition at line 67 of file application.cpp.

References checkConfigFile(), g_settings, Settings::getString(), Settings::loadSettings(), locateFile(), and LOGE.

Referenced by ApplicationServer::init(), and ApplicationClient::init().

Here is the call graph for this function:

virtual void Application::run  )  [pure virtual]
 

Implemented in ApplicationClient, and ApplicationServer.

void Application::saveUserConfigFile const char *  file,
const char *  file_template
[protected]
 

Definition at line 85 of file application.cpp.

References checkConfigFile(), g_settings, Settings::getString(), locateFile(), LOGE, and Settings::saveSettings().

Referenced by ApplicationServer::clean(), and ApplicationClient::clean().

Here is the call graph for this function:


Member Data Documentation

TaskManager Application::mTaskManager [protected]
 

global version of task manager

Definition at line 110 of file application.h.

Referenced by getTaskManager(), ApplicationServer::init(), and ApplicationClient::init().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:11:20 2006 for bjs by  doxygen 1.4.5