Package g4ds :: Module messagehandler :: Class MessageContextController
[show private | hide private]
[frames | no frames]

Class MessageContextController


Stores all information about incoming messages.

Incoming messages are unwrapped at many several locations within the G4DS module tree. In order to avoid passing this information from one function to another, a message context may be created for this message. The key is always the message id - this way, only the message id needs to be passed and all remaining information may be accessed using the id.
Method Summary
  __init__(self)
Initialises the dictionary for messages.
  addMessage(self, messageid)
Initialises a new context for a certain message.
  addValue(self, messageid, key, value)
Adds a value to the context of the message with the given id.
  deleteMessage(self, messageid)
Deletes the context for the given message id.
any getValue(self, messageid, key)
Requests a value for a certain message stored behind a certain key.

Method Details

__init__(self)
(Constructor)

Initialises the dictionary for messages.

addMessage(self, messageid)

Initialises a new context for a certain message.

addValue(self, messageid, key, value)

Adds a value to the context of the message with the given id.
Parameters:
messageid - Id of the message in the first place
           (type=String)
key - Key for this value (must be used for requesting the content later on)
           (type=String)
value - The value to be stored in the context for this message behind the given key
           (type=any)

deleteMessage(self, messageid)

Deletes the context for the given message id.
Parameters:
messageid - ID of the message in the first place.
           (type=String)

getValue(self, messageid, key)

Requests a value for a certain message stored behind a certain key.
Parameters:
messageid - Id of the message in the first place
           (type=String)
key - Key for the requested value
           (type=String)
Returns:
The value behind the key
           (type=any)

Note: If there is no value behind the given key, an KeyError will be produced.


Generated by Epydoc 2.0 on Sat Oct 22 22:52:46 2005 http://epydoc.sf.net