Class MemoryValueProcessor

java.lang.Object
org.scictrl.csshell.epics.server.processor.AbstractValueProcessor
org.scictrl.csshell.epics.server.processor.MemoryValueProcessor
All Implemented Interfaces:
ValueProcessor
Direct Known Subclasses:
CommandValueProcessor, DefaultAlarmProcessor, EnumValueProcessor, ForwardValueProcessor, HeartbeatValueProcessor, InterlockValueProcessor, LinkedValueProcessor, ManagementProcessor, MemorySwitchValueProcessor, PolyTransValueProcessor, RunningAverageValueProcessor, SemaphoreProcessor, SimAlarmProcessor, TimeCounterProcessor, TimeValueProcessor, UpdateRateProcessor, ValueCheckProcessor

public class MemoryValueProcessor extends AbstractValueProcessor

MemoryValueProcessor class.

Author:
igor@scictrl.com
  • Field Details

    • value

      protected Object value
      Value held by this processor.
    • fixed

      protected boolean fixed
      Value is fixed.
    • timestamp

      protected gov.aps.jca.dbr.TimeStamp timestamp
      Timestamp of last value update.
    • lastChangeTimestamp

      protected gov.aps.jca.dbr.TimeStamp lastChangeTimestamp
      Timestamp of last value change.
  • Constructor Details

    • MemoryValueProcessor

      public MemoryValueProcessor()

      Constructor for MemoryValueProcessor.

  • Method Details

    • newDoubleProcessor

      public static final AbstractValueProcessor newDoubleProcessor(String name, String description, double value, boolean fixed)

      newDoubleProcessor.

      Parameters:
      name - a String object
      description - a String object
      value - a double
      fixed - a boolean
      Returns:
      a AbstractValueProcessor object
    • newBooleanProcessor

      public static final AbstractValueProcessor newBooleanProcessor(String name, String description, boolean value, boolean fixed, boolean undefined)

      newBooleanProcessor.

      Parameters:
      name - a String object
      description - a String object
      value - a boolean
      fixed - a boolean
      undefined - a boolean
      Returns:
      a AbstractValueProcessor object
    • newProcessor

      public static final AbstractValueProcessor newProcessor(String name, gov.aps.jca.dbr.DBRType type, int count, String description, Object value, boolean fixed, boolean undefined)

      newProcessor.

      Parameters:
      name - a String object
      type - a DBRType object
      count - a int
      description - a String object
      value - a Object object
      fixed - a boolean
      undefined - a boolean
      Returns:
      a AbstractValueProcessor object
    • newProcessor

      public static final AbstractValueProcessor newProcessor(String name, gov.aps.jca.dbr.DBRType type, int count, String description, Object value, boolean fixed, Number min, Number max, String units, short precision)

      newProcessor.

      Parameters:
      name - a String object
      type - a DBRType object
      count - a int
      description - a String object
      value - a Object object
      fixed - a boolean
      min - a Number object
      max - a Number object
      units - a String object
      precision - a short
      Returns:
      a AbstractValueProcessor object
    • getTimestamp

      public gov.aps.jca.dbr.TimeStamp getTimestamp()
      Timestamp indicates last time value has been updated or confirmed. This does not necessary means value change.
      Returns:
      a TimeStamp object
    • setValue

      public void setValue(Object value)
      Sets new value to the processor. If value is different from current processor value, then event is fired. Timestamp is updated regardless if value is changed, since timestamp indicates last value update or confirmation. This method is used by remote EPICS entity or other record within same Database. By definition calling setValue must always update value, because further processing must be triggered.
      Parameters:
      value - a Object object
    • _setValue

      protected boolean _setValue(Object value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify)
      Internal set: sets new value to this processor. It checks if it is fixed, it never sets fixed value. Fires value update event only if value was changes and notify is true. If value was not changed, update is not forced. If the value is not an array it tries to convert it to a single element array. Updates timestamp. If required fires notify event.
      Parameters:
      value - value to be set
      severity - the severity to be used together with the value update. If null no alarm update is fired.
      status - the status to be used together with the value update. If null no alarm update is fired.
      notify - if true fire notify event if value was change, false suppresses events
      Returns:
      true if value was updated, regardless if based on difference or force
    • _setValue

      protected boolean _setValue(Object value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify, boolean force)
      Internal set: sets new value to this processor. It checks if it is fixed, it never sets fixed value. Fires value update event only if value was changes and notify is true. If force is true, then updates value and fires notify, if notify is true, even if value was not changed. If the value is not an array it tries to convert it to a single element array. Updates timestamp. If required fires notify event.
      Parameters:
      value - value to be set
      severity - the severity to be used together with the value update. If null no alarm update is fired.
      status - the status to be used together with the value update. If null no alarm update is fired.
      notify - if true fire notify event if value was change, false suppresses events
      force - if true it will update value and timestamp even if there is not new value and proceeds with notify
      Returns:
      true if value was updated, regardless if based on difference or force
    • convert

      protected Object convert(Object val)

      convert.

      Parameters:
      val - a Object object
      Returns:
      a Object object
    • _forceValueUpdateEvent

      protected boolean _forceValueUpdateEvent()
      Updates the timestamp and fires value update event, if processor has value other than null.
      Returns:
      true if update was fired
    • _setValue

      protected boolean _setValue(boolean value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify)
      Internal set: sets new value to this processor. It checks if it is fixed, it never sets fixed value. Fires value update event only if value was changes and notify is true. If force is true, then updates value and fires notify, if notify is true, even if value was not changed. If the value is not an array it tries to convert it to a single element array. Updates timestamp. If required fires notify event.
      Parameters:
      value - value to be set
      severity - the severity to be used together with the value update. If null no alarm update is fired.
      status - the status to be used together with the value update. If null no alarm update is fired.
      notify - if true fire notify event if value was change, false suppresses events
      Returns:
      true if value was updated, regardless if based on difference or force
    • _setValue

      protected boolean _setValue(boolean value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify, boolean force)
      Internal set: sets new value to this processor. It checks if it is fixed, it never sets fixed value. Fires value update event only if value was changes and notify is true. If force is true, then updates value and fires notify, if notify is true, even if value was not changed. If the value is not an array it tries to convert it to a single element array. Updates timestamp. If required fires notify event.
      Parameters:
      value - value to be set
      severity - the severity to be used together with the value update. If null no alarm update is fired.
      status - the status to be used together with the value update. If null no alarm update is fired.
      notify - if true fire notify event if value was change, false suppresses events
      force - if true it will update value and timestamp even if there is not new value and proceeds with notify
      Returns:
      true if value was updated, regardless if based on difference or force
    • getValueAsBoolean

      public boolean getValueAsBoolean()

      getValueAsBoolean.

      Returns:
      a boolean
    • getValue

      public Object getValue()

      getValue.

      Returns:
      a Object object
    • getChangeAccessTimestamp

      public gov.aps.jca.dbr.TimeStamp getChangeAccessTimestamp()
      Returns timestamp of last value change.
      Returns:
      timestamp of last value change
    • isFixed

      public boolean isFixed()

      isFixed.

      Returns:
      a boolean
    • setFixed

      public void setFixed(boolean fixed)

      Setter for the field fixed.

      Parameters:
      fixed - a boolean
    • configure

      public void configure(Record record, org.apache.commons.configuration.HierarchicalConfiguration config)
      Configures the internals of value processor, provides reference to parent record and to configuration with root inside processor tag. Parent record is not yet initialized, so does not have reference to Database, the Database reference will be available during activate call.
      Specified by:
      configure in interface ValueProcessor
      Overrides:
      configure in class AbstractValueProcessor
      Parameters:
      record - the parent record.
      config - configuration with room inside processor tag.
    • activate

      public void activate()
      Record has now reference to Database. processor might want to connect to other records on this server or PVs on other servers. This can not be done until all records from configuration has been loaded. Call to this method signals to the processor that records has been loaded and linking to other values can be commenced.
      Specified by:
      activate in interface ValueProcessor
      Overrides:
      activate in class AbstractValueProcessor