class Engine

Engine globals. More...

Full nameTelEngine::Engine
Definition#include <yatengine.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods


Detailed Description

This class holds global information about the engine. Note: this is a singleton class.

enum RunMode { Stopped = 0, Console = 1, Client = 2, Server = 3, }

RunMode

Running modes - run the engine as Console, Client or Server.

int  main (int argc, const char** argv, const char** env, RunMode mode = Console, bool fail = false)

main

[static]

Main entry point to be called directly from a wrapper program

Parameters:
argcArgument count
argvArgument array
envEnvironment variables
modeMode the engine must run as - Console, Client or Server
failFail and return after parsing command line arguments

Returns: Program exit code

void  help (bool client, bool errout = false)

help

[static]

Display the help information on console

Parameters:
clientDisplay help for client running mode
erroutDisplay on stderr intead of stdout

int  run ()

run

Run the engine.

Returns: Error code, 0 for success

Engine*  self ()

self

[static]

Get a pointer to the unique instance.

Returns: A pointer to the singleton instance of the engine

RunMode  mode ()

mode

[static]

Get the running mode of the engine

Returns: Engine's run mode as enumerated value

inline bool  clientMode ()

clientMode

[static]

Check if the engine is running as telephony client

Returns: True if the engine is running in client mode

bool  Register (const Plugin* plugin, bool reg = true)

Register

[static]

Register or unregister a plugin to the engine.

Parameters:
pluginA pointer to the plugin to (un)register
regTrue to register (default), false to unregister

Returns: True on success, false on failure

String  configFile (const char* name, bool user = false)

configFile

[static]

Get the filename for a specific configuration

Parameters:
nameName of the configuration requested
userTrue to build a user settings path

Returns: A full path configuration file name

inline String&  configPath ()

configPath

[static]

Get the system configuration directory path

Returns: The directory path for system configuration files

inline String&  configSuffix ()

configSuffix

[static]

Get the configuration file suffix

Returns: The suffix for configuration files

inline String&  modulePath ()

modulePath

[static]

The module loading path

inline String&  extraPath ()

extraPath

[static]

The relative extra module loading path. This is empty by default but can be set by a main program to a value before calling main()

inline String&  moduleSuffix ()

moduleSuffix

[static]

Get the module filename suffix

Returns: The suffix for module files

const char*  pathSeparator ()

pathSeparator

[static]

Get the canonical path element separator for the operating system

Returns: The operating system specific path element separator

const Configuration&  config ()

config

[static]

The global configuration of the engine. You must use this resource with caution. Note that sections [general], [modules], [preload] and [postload] are reserved by the engine. Also [telephony] is reserved by the drivers.

Returns: A reference to the read-only engine configuration

unsigned int  runId ()

runId

[static]

Get a - supposedly unique - instance ID

Returns: Unique ID of the current running instance

void  init ()

init

[static]

Reinitialize the plugins

void  halt (unsigned int code)

halt

[static]

Stop the engine and the entire program

Parameters:
codeReturn code of the program

bool  restart (unsigned int code, bool gracefull = false)

restart

[static]

Stop and restart the engine and the entire program

Parameters:
codeReturn code of the program
gracefullAttempt to wait until no plugin is busy

Returns: True if restart was initiated, false if exiting or no supervisor

bool  exiting ()

exiting

[static]

Check if the engine is currently exiting

Returns: True if exiting, false in normal operation

bool  install (MessageHandler* handler)

install

[static]

Installs a handler in the dispatcher.

Parameters:
handlerA pointer to the handler to install

Returns: True on success, false on failure

bool  uninstall (MessageHandler* handler)

uninstall

[static]

Uninstalls a handler drom the dispatcher.

Parameters:
handlerA pointer to the handler to uninstall

Returns: True on success, false on failure

bool  enqueue (Message* msg)

enqueue

[static]

Enqueue a message in the message queue for asynchronous dispatching

Parameters:
msgThe message to enqueue, will be destroyed after dispatching

Returns: True if enqueued, false on error (already queued)

inline bool  enqueue (const char* name)

enqueue

[static]

Convenience function. Enqueue a new parameterless message in the message queue

Parameters:
nameName of the parameterless message to put in queue

Returns: True if enqueued, false on error (already queued)

bool  dispatch (Message* msg)

dispatch

[static]

Synchronously dispatch a message to the registered handlers

Parameters:
msgPointer to the message to dispatch

Returns: True if one handler accepted it, false if all ignored

bool  dispatch (Message& msg)

dispatch

[static]

Synchronously dispatch a message to the registered handlers

Parameters:
msgThe message to dispatch

Returns: True if one handler accepted it, false if all ignored

bool  dispatch (const char* name)

dispatch

[static]

Convenience function. Dispatch a parameterless message to the registered handlers

Parameters:
nameThe name of the message to create and dispatch

Returns: True if one handler accepted it, false if all ignored

inline void  setHook (MessagePostHook* hook, bool remove = false)

setHook

Install or remove a hook to catch messages after being dispatched

Parameters:
hookPointer to a post-dispatching message hook
removeSet to True to remove the hook instead of adding

int  usedPlugins ()

usedPlugins

Get a count of plugins that are actively in use

Returns: Count of plugins in use

inline unsigned int  messageCount ()

messageCount

Get the number of messages waiting in the queue

Returns: Count of messages in the queue

inline unsigned int  handlerCount ()

handlerCount

Get the number of handlers in the dispatcher

Returns: Count of handlers

bool  loadPluginDir (const String& relPath)

loadPluginDir

Loads the plugins from an extra plugins directory

Parameters:
relPathPath to the extra directory, relative to the main modules

Returns: True if the directory could at least be opened

 ~Engine ()

~Engine

[protected]

Destroys the engine and everything. You must not call it directly, run() will do it for you.

bool  loadPlugin (const char* file, bool local = false)

loadPlugin

[protected]

Loads one plugin from a shared object file

Parameters:
fileName of the plugin file to load
localAttempt to keep symbols local if supported by the system

Returns: True if success, false on failure

void  loadPlugins ()

loadPlugins

[protected]

Loads the plugins from the plugins directory

void  initPlugins ()

initPlugins

[protected]

Initialize all registered plugins


Generated by: root on dragoshel on Sat Apr 14 01:50:50 2007, using kdoc 2.0a54.