Next: Display objects
Up: Program component descriptions
Previous: Program component descriptions
Figure 5.1 illustrates the utility objects used in VMD program development. Several of these objects are C++ templates; instances of these classes are creates for different types, for example a Stack of integers or a Stack of char * items. These template and the other global objects are each detailed in section 6.2.
The Inform class is deserving of particular notice, since it is one of the most widely used objects in VMD. This class provides a streams-like object which is used to print messages to the VMD console. There are four global instances of this class, which are used for the following purposes:
- msgInfo
Used to display informative messages, which provide some data or message to the user which is either requested or ``typically'' provided. For example, the messages describing the current status of the process of reading a molecule from a file or a network connection are printed by sending text to the msgInfo instance of an Inform object.
- msgWarn
Used to display warning messages. These are messages which do not indicate a fatal program condition, but which caution the user that things may not be going as they expect.
- msgErr
Error messages are displayed by sending text to the msgErr instantiation.
- msgDebug
Where debugging messages are printed. It is possible to exclude the source code lines which print debugging messages when VMD is compiled, to produce a smaller and faster executable, by eliminating the DEBUG compilation option.
To use an Inform object, text and data are given to object using insertion (<<) operators, i.e.,
msgInfo << "This is message number " << intVariable << "." << sendmsg;
The sendmsg manipulator ends the message; this will cause the message to be printed to the console, prepended by a string indicating the type of messages, and appended by a newline.
There are also several utility functions which are not part of any class; these are described in section 6.1.
Next: Display objects
Up: Program component descriptions
Previous: Program component descriptions
Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999