Package driver :: Module driverapi
[show private | hide private]
[frames | no frames]

Module driver.driverapi

This is an api for driver stuff. This just makes things easier to code in the driver. Driver things should use this API to access other driver things--it centralizes some of the business logic into a standard interface. In addition, the mudlib should use the driverapi to access things in the driver.
Function Summary
  add_manager(name, manager)
Adds a manager to the Engine.
Engine get_engine()
Retrieves the Engine singleton.
Manager get_manager(name)
Retrieves a manager from the engine.
  log(message)
Logs stuff to stdout.
  print_traceback(message)
Convenience method for grabbing the traceback, formatting it, and piping it to the logs.
  register_hook(hookname, func, place)
Registers a function with a given hook.
Thread start_thread(threadname, threadfunc)
Starts a thread with the name and func given.

Variable Summary
str DISCONNECT_LINKDEATH = 'linkdeath'
str DISCONNECT_QUIT = 'quit'
int HOOK_FIRST = 1                                                                     
int HOOK_LAST = 99                                                                    

Function Details

add_manager(name, manager)

Adds a manager to the Engine.
Parameters:
name - the name of the manager to add
           (type=string)
manager - the manager to add
           (type=Manager)

get_engine()

Retrieves the Engine singleton.
Returns:
the Engine object singleton
           (type=Engine)

get_manager(name)

Retrieves a manager from the engine.
Parameters:
name - the name of the manager to retrieve
           (type=string)
Returns:
the manager or None
           (type=Manager)

log(message)

Logs stuff to stdout.
Parameters:
message - the message to log to stdout.
           (type=string)

print_traceback(message='')

Convenience method for grabbing the traceback, formatting it, and piping it to the logs.
Parameters:
message - any message you want to pass to the user--this gets printed first
           (type=string)

register_hook(hookname, func, place=None)

Registers a function with a given hook. If the hook doesn't exist then it instantiates the hook.
Parameters:
hookname - the name of the hook
           (type=string)
func - the function to call when that hook is spammed
           (type=function)
place - the function will get this place in the call order. functions with the same place specified will get arbitrary ordering. defaults to LAST.
           (type=int)

start_thread(threadname, threadfunc)

Starts a thread with the name and func given.
Parameters:
threadname - the name of the thread to start
           (type=string)
threadfunc - the function for the thread to work on
           (type=function)
Returns:
the thread just created
           (type=Thread)

Variable Details

DISCONNECT_LINKDEATH

Type:
str
Value:
'linkdeath'                                                            

DISCONNECT_QUIT

Type:
str
Value:
'quit'                                                                 

HOOK_FIRST

Type:
int
Value:
1                                                                     

HOOK_LAST

Type:
int
Value:
99                                                                    

Generated by Epydoc 2.0 on Wed Jan 21 21:00:06 2004 http://epydoc.sf.net