Users can define measurements that become fully integrated with other measurements in the object model. To do so, an instance of McUserMeasure is created and then passed to McEngine.RegisterUserMeasurement along with a name for the measurement. Subsequently, this measurement may be invoked by name on any parent object which it supports (usually an McFeatures object).
An instance of this interface must be supplied to the McEngine.RegisterMeasurement method. The McUserMeasure's job is to supply all of the information necessary to describe and compute some measurement on a given McFeatures instance. The calling routines handle all of the heavy lifting with respect to exposing the McMeasure interface (that all measurements must expose) and implementing most of its methods.
When your user-defined measurements are only needed temporarily and performance is not critical you can avoid fully implementing an McUserMeasure object, and use the one that is already defined. The predefined McUserMeasure object gets its measurement results via event notifications. You may create an instance of this class WithEvents to compute a user defined measurement. Using this notification approach means that you only have to implement a minimum of one Sub in VB to support a custom measurement. You must supply at least the ComputeValue event handler (see the EventBasedUserMeasure form sample).
The WithEvents approach may be slightly easier than implementing an instance of the McUserMeasure class yourself (see the CUserMeasureCircularityMinCode.cls sample, which makes the same measurement as the EventBasedUserMeasure.frm sample). But the class implementation approach has much less overhead, is conceptually cleaner, does not require a form and is little, if any, extra work, so you should use a .CLS module except in very unusual circumstances. You should always use the class-based approach if you need your measurement to be available independent of a defining form, and you should always use this approach if you are adding a new generally accessable measurement.
For McUserMeasure interfaces implemented by the caller, at the minimum, only the ComputeValue method must do anything. All other methods can just return without doing anything. However, for a measurement that you want to publish to other users, you should also support the the UserDisplayName and UserDescription and UserAttributes methods.