Every module class has some additional utility methods that are useful from time to time. You can get a module's name using the Name() method. Name() returns a constant character string that corresponds to the instance name. The instance name is the name that you give to modules and does not have to be unique in a pipeline.
You can use the Type() method to obtain the type name of the module. The string returned by this method is identical to the type name used in the constructors for PDLSource, PDLFilter, and PDLSink.
Sometimes you will change the instance name of a module interactively in MotionSampler's pipeline editor. You can detect the change by redefining the module method NameChanged(). MotionSampler calls this method whenever a module's name is changed. This is handy if your module uses its name in a widget interface title and would like to update the display when it changes.
Occasionally, a module can detect that something is wrong that a user should be informed of. The ParseStatement() method is a place where a module is likely to find bad keywords and arguments and it should inform you of the error. Standard C++ iostreams and printf() functions can be used by modules to write messages to the shell window where MotionSampler was launched. However, using the Error() method provided by each module class is usually better and more consistent. MotionSampler catches these messages and routes them to the MotionSampler's error log. It also beeps and changes the Help menu to red to catch your attention.
The Error() method works like the standard printf() function. It takes a string argument containing text and formatting information followed by a number of arguments. The following example prints an error using an integer argument.
Error("List count of %d exceeds max of %d.\n", count, 10);
A filter module with a type of ExampleFilt and the name Sample will print the example error as follows:
Error Filter ExampleFilt "Sample": List count of 11 exceeds max of 10.