register_point, register_existing_point

Gamma: Version 4.0
Prev |  | Next

# `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 the The PID Controller Class section or the Automatically Change SP Value section of the PID Emulator chapter, or the Starting Programs section of the Common Functions chapter (Tutorial One) in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

## See Also

`init_ipc`, `next_event`, `next_event_nb`, `when_echo`, `when_exception`

Prev | Home | Next
`register_exception` | Up | `remove_echo_function`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.