org.epics.pvmanager
Class PV<R,W>

java.lang.Object
  extended by org.epics.pvmanager.PV<R,W>
Type Parameters:
R - type of the read payload
W - type of the write payload
All Implemented Interfaces:
PVReader<R>, PVWriter<W>

public class PV<R,W>
extends Object
implements PVReader<R>, PVWriter<W>

A PV that can be both read and written. In general, the read payload will be different from the write payload.

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 addPVWriterListener(PVWriterListener 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.
 R 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).
 Exception lastWriteException()
          Returns the last exception that was generated by write operations and clears it (subsequent call will return null).
 void removePVReaderListener(PVReaderListener listener)
          Removes a listener to the value.
 void removePVWriterListener(PVWriterListener listener)
          Removes a listener to the value.
 void write(W newValue)
          Writes a new value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addPVWriterListener

public void addPVWriterListener(PVWriterListener listener)
Description copied from interface: PVWriter
Adds a listener to the value. This method is thread safe.

Specified by:
addPVWriterListener in interface PVWriter<W>
Parameters:
listener - a new listener

removePVWriterListener

public void removePVWriterListener(PVWriterListener listener)
Description copied from interface: PVWriter
Removes a listener to the value. This method is thread safe.

Specified by:
removePVWriterListener in interface PVWriter<W>
Parameters:
listener - the old listener

write

public void write(W newValue)
Description copied from interface: PVWriter
Writes a new value. This method can be synchronous or synchronous depending on how the PV was created.

Specified by:
write in interface PVWriter<W>

lastWriteException

public Exception lastWriteException()
Description copied from interface: PVWriter
Returns the last exception that was generated by write operations and clears it (subsequent call will return null).

Specified by:
lastWriteException in interface PVWriter<W>
Returns:
the last generated exception or null

addPVReaderListener

public void addPVReaderListener(PVReaderListener listener)
Description copied from interface: PVReader
Adds a listener to the value. This method is thread safe.

Specified by:
addPVReaderListener in interface PVReader<R>
Parameters:
listener - a new listener

addPVReaderListener

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

Specified by:
addPVReaderListener in interface PVReader<R>
Parameters:
clazz - type to filter notifications for
listener - a new listener

removePVReaderListener

public void removePVReaderListener(PVReaderListener listener)
Description copied from interface: PVReader
Removes a listener to the value. This method is thread safe.

Specified by:
removePVReaderListener in interface PVReader<R>
Parameters:
listener - the old listener

getName

public String getName()
Description copied from interface: PVReader
Returns the name of the PVReader. This method is thread safe.

Specified by:
getName in interface PVReader<R>
Returns:
the value of name

getValue

public R getValue()
Description copied from interface: PVReader
Returns the value of the PVReader. Not thread safe: can be safely accessed only as part of the PVReaderListener.

Specified by:
getValue in interface PVReader<R>
Returns:
the value of value

close

public void close()
Description copied from interface: PVReader
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.

Specified by:
close in interface PVReader<R>
Specified by:
close in interface PVWriter<W>

isClosed

public boolean isClosed()
Description copied from interface: PVReader
True if no more notifications are going to be sent for this PVReader.

Specified by:
isClosed in interface PVReader<R>
Specified by:
isClosed in interface PVWriter<W>
Returns:
true if closed

lastException

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

Specified by:
lastException in interface PVReader<R>
Returns:
the last generated exception or null


Copyright © 2011. All Rights Reserved.