Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
182
Chapter 7: Creating an Operation
Registering an Operation
iTool Developer’s Guide
Registering an Operation
Before an operation can be performed by an iTool, the operation’s class definition 
must be registered as being available to the iTool. Registering an operation with the 
iTool links the class definition file that contains the actual IDL code that defines the 
operation with a simple string that names the type. Code that performs an operation in 
an iTool uses the name string to specify which operation should be performed.
Using IDLitTool::RegisterOperation
In most cases, you will register an operation with the iTool in the iTool’s class Init 
method. Registration ensures that the operation is available to the iTool. (See 
 on page 91 for details on the iTool class Init method.) 
To register an operation, call the IDLitTool::RegisterOperation method:
self->RegisterOperation, 
OperationName, Operation_Class_Name
where OperationName is the string you will use when referring to the operation, and 
Operation_Class_Name
 is a string that specifies the name of the class file that 
contains the operation’s definition. 
Note
The file 
Operation_Class_Name__define.pro
 must exist somewhere in 
IDL’s path for the visualization type to be successfully registered.
See 
Specifying Useful Properties
You can set any property of th
 and 
 classes when 
registering an operation. The following properties may be of particular interest:
EXPENSIVE_COMPUTATION
A boolean value that indicates whether the operation is expensive. Expensive 
operations are those that require significant memory or processing time to execute. 
Individual operations should use the value of this property to determine whether the 
results of the operation should be cached to avoid re-execution when undoing or 
redoing.