5-14 SOMobjects Base Toolkit Programmer’s Reference
Manual
someRegister Method
Purpose
Registers an object/method pair with EMan, given a specified registerData object.
IDL Syntax
long someRegister (
in SOMEEMRegisterData registerData,
in SOMObject targetObject,
in string targetMethod,
in void *targetData);
Description
This method allows for registering an event of interest with EMan, with an object method as
the callback. It is assumed that the target method has been declared as using OIDL
callstyle. The event of interest and its details are filled in a registration data object
registerData. The information about the callback routine is indicated by targetObject and
targetMethod.
A mismatch between the target method’s callstyle and the registration method used (that is,
someRegister vs. someRegisterEv) can result in unpredictable results.
Note: The target method is called using name-lookup method resolution.
Parameters
receiver A pointer to an object of class SOMEEMan.
ev A pointer to the Environment structure for the calling method.
registerData A pointer to the registration data object that contains all the necessary
information about the event for which an interest is being registered with
EMan.
targetObject A pointer to the object that is the target of the callback method.
targetMethod The name of the callback method.
targetData A pointer to a data structure to be passed to the callback method when the
event occurs.
Return Value
The registration ID.
Example
#include <eman.h>
#include <emobj.h>
Environment *testEnv = somGetGlobalEnvironment();
some_gEMan = SOMEEManNew();/* create an EMan object */
data = SOMEEMRegisterDataNew( ); /* create a reg data object */
target = EMObjectNew(); /* create a target object */
/* reRegister a timer event */
_someClearRegData( data, env );
_someSetRegDataEventMask( data, env, EMTimerEvent, NULL );
_someSetRegDataTimerInterval( data, env, 100 );
regId1 = _someRegister( some_gEMan, env, data, target,
”eventMethod”, ”Timer 100” );
Kommentare zu diesen Handbüchern