timer class : Signature(string) setter

Description

Sets the signature of the handler.

Syntax

instance.Signature = value;

Arguments

ClassDescription
stringThe signature of the handler.

Return value

None

Sample code

Suppose you have the following class definition.

1:

class handle

2:

open method void THandlerA(dictionary dic)

3:

... // timer handler code.

4:

endmethod

5:

open method void THandlerB(dictionary dic)

6:

... // timer handler code.

7:

endmethod

8:

endclass

Usage of the Signature setter is as follows.

1:

handle h = new handle();

2:

timer tim = new timer(h,"THandlerA(dictionary)", 1000); // It sets the signature of the THandlerA(dictionary) method.

3:

tim.Signature = "THandlerB(dictionary)"; // It changes the signature to the THandlerB(dictionary) method.

4:

tim.Start();

The timer searches a handler with the Signature.

After the set time has elapsed, the timer looks for the Signature - THandlerB(dictionary) - in the Handler - an instance of the handle class - and calls it as a handler.

Notes

You should set an open method has an argument of dictionary class as Signature.

If you set an closed method as Signature, an exception will occur on call.


The signature is the information for the timer to call the handler. It is a string that concatenates the handler method name and arguments.

The handler must be an open method with one argument of the dictionary class. If the method name of the handler is "handlerName", the definition of the handler is as follows.


"handlerName(dictionary)"

Links for reference

None

Copyright © Cooker All rights reserved.