org.epics.pvmanager
Interface PVReader<T>

Type Parameters:
T - the type of the PVReader.
All Known Implementing Classes:
PV

public interface PVReader<T>

An object representing the PVReader. It contains all elements that are common to all PVs of all type. The payload is specified by the generic type, and is returned by getValue(). Changes in values are notified through the PVReaderListener. Listeners can be registered from any thread. The value can only be accessed on the thread on which the listeners is called.

Author:
carcassi

Method Summary
 void addPVReaderListener(Class<?> clazz, PVReaderListener listener)
          Adds a listener to the value, which is notified only if the value is of a given type.
 void addPVReaderListener(PVReaderListener listener)
          Adds a listener to the value.
 void close()
          De-registers all listeners, stops all notifications and closes all connections from the data sources needed by this.
 String getName()
          Returns the name of the PVReader.
 T getValue()
          Returns the value of the PVReader.
 boolean isClosed()
          True if no more notifications are going to be sent for this PVReader.
 Exception lastException()
          Returns the last exception that was generated preparing the value for this PVReader and clears it (subsequent call will return null).
 void removePVReaderListener(PVReaderListener listener)
          Removes a listener to the value.
 

Method Detail

addPVReaderListener

void addPVReaderListener(PVReaderListener listener)
Adds a listener to the value. This method is thread safe.

Parameters:
listener - a new listener

addPVReaderListener

void addPVReaderListener(Class<?> clazz,
                         PVReaderListener listener)
Adds a listener to the value, which is notified only if the value is of a given type. This method is thread safe.

Parameters:
clazz - type to filter notifications for
listener - a new listener

removePVReaderListener

void removePVReaderListener(PVReaderListener listener)
Removes a listener to the value. This method is thread safe.

Parameters:
listener - the old listener

getName

String getName()
Returns the name of the PVReader. This method is thread safe.

Returns:
the value of name

getValue

T getValue()
Returns the value of the PVReader. Not thread safe: can be safely accessed only as part of the PVReaderListener.

Returns:
the value of value

close

void close()
De-registers all listeners, stops all notifications and closes all connections from the data sources needed by this. Once the PVReader is closed, it can't be re-opened. Subsequent calls to close do not do anything.


isClosed

boolean isClosed()
True if no more notifications are going to be sent for this PVReader.

Returns:
true if closed

lastException

Exception lastException()
Returns the last exception that was generated preparing the value for this PVReader and clears it (subsequent call will return null).

Returns:
the last generated exception or null


Copyright © 2011. All Rights Reserved.