next up previous contents
Next: NameList Up: Utility objects Previous: Utility objects   Contents

Subsections


Inform

Files: Inform.h, Inform.c
Derived from: none
Global instance (if any): msgInfo, msgWarn, msgErr, msgDebug
Used in optional component: Part of main VMD code

Description

A streams-like utility object used to format messages for display at the console or other selectable ostream object. Messages are given to an Inform object via insertion operators («), and the messages are printed out to a provided ostream device, prefixed by a certain string. A special manipulator `sendmsg' is used to signal when a mesage should be printed.

Each Inform object has a current `message level', which is also indicated when the messages are printed out. Routines are provided to set the current level of the Inform object, so that only messages with a level smaller than or equal to the current output level are printed. Levels range from 1 (most likely to be printed) to 10 (very unlikely to be printed). The main use of this feature in VMD is in conjunction with debugging messages, where the level of debugging information can be changed via text commands.

There are four global instances of Inform which are available to the entire program (as long as they include the file Inform.h):

Constructors

Enumerations, lists or character name arrays

Inform contains several manipulators used to determine how the message is printed or to do actions. They are:

Internal data structures

Nonvirtual member functions

Method of use

As stated, there are four global instances of Inform which should be used for printing all messages in VMD. They are used just like a stream, except the manipulator sendmsg is used instead of endl to signal that the string should be printed. An example:
msgWarn « level3 « "This is a level-3 warning." « sendmsg;
In this case, if msgWarn is on, and it's output level is greater than or equal to 3, then this message will be printed, otherwise it will be ignored.

For debugging messages (printed to msgDebug), make sure to use the MSGDEBUG macro, so that these debugging messages can be conditionally excluded from the executable.

Suggestions for future changes/additions

Right now, only the debug Inform object takes advantage of the message level facility, all other messages (information, warning, or error) are all level-1 messages. More messages should be printed out by VMD, but at different levels of verbosity and content, and text commands should be put in to control the current output level of msgInfo, msgWarn, and msgErr.

Text commands should be added to allow the message text to be sent to a file, or to the console (right now, they are always sent to the console). This would not be very difficult, a new text command would need to be added which would open a file, and call the destination routine with the respective ostream pointer.


next up previous contents
Next: NameList Up: Utility objects Previous: Utility objects   Contents
vmd@ks.uiuc.edu