register_point, register_existing_point

register_point, register_existing_point — register an application to receive exceptions for a single point.

Syntax

register_point (symbol)
register_existing_point (symbol)

		

Arguments

symbol

A point name, as a symbol.

Returns

The current value of the point in the Cascade DataHub. If the point does not exist, register_point will create the point in the datahub and return a default value. However register_existing_point will return nil if the point does not exist.

Description

These functions register an application to receive changes in the value of a point whenever they occur. The current value of the point is returned as a result of the registration. Once this function has been called, any changes to the value of the point in the Cascade DataHub will be transmitted to the input queue of the application. These changes are events, and as such must be processed by calling next_event or next_event_nb before the application will recognize the new value of the point.

A function may be attached to the value change event using the when_exception and when_echo functions. Regardless of whether an event is attached to the point, the interpreter will update the value of the symbol whose name is the same as the point name. This means that once a point has been registered its value will always be current in the global scope of the interpreter. If the point name is pre-qualified with a domain name and a colon (:), this function will search that domain's datahub rather than the datahub for the default domain.

Example

Gamma> register_point(#f);
26
Gamma> write_point(#f,85);
t
Gamma> f;
26
Gamma> next_event();
nil
Gamma> f;
85
Gamma> register_existing_point(#newpoint);
nil
Gamma> register_point("newpoint");
0
Gamma> register_point("acme:newpoint");
0
		

See Also

init_ipc, next_event, next_event_nb, when_echo, when_exception