All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cosylab.epics.caj.cas.util.FloatingDecimalProcessVariable Maven / Gradle / Ivy

Go to download

JCA is an EPICS Channel Access library for Java. For more information concerning EPICS or Channel Access please refer to the <a href="http://www.aps.anl.gov/epics">EPICS Web pages</a> or read the <a href="http://www.aps.anl.gov/epics/base/R3-14/8-docs/CAref.html">Channel Access manual (3.14)</a>. <p>This module also includes CAJ, A 100% pure Java implementation of the EPICS Channel Access library.</p>

There is a newer version: 2.4.10
Show newest version
/*
 * Copyright (c) 2004 by Cosylab
 *
 * The full license specifying the redistribution, modification, usage and other
 * rights and obligations is included with the distribution of this project in
 * the file "LICENSE-CAJ". If the license is not included visit Cosylab web site,
 * .
 *
 * THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
 * IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, ASSUMES
 * _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE RESULTING FROM THE USE, MODIFICATION,
 * OR REDISTRIBUTION OF THIS SOFTWARE.
 */

package com.cosylab.epics.caj.cas.util;

import gov.aps.jca.cas.ProcessVariableEventCallback;
import gov.aps.jca.dbr.DBR;
import gov.aps.jca.dbr.PRECISION;

/**
 * Abstract convenient floating decimal process variable implementation.
 * This implementation specializes NumericProcessVariable - adds precision support.
 * Implementation does not handle status, severity and alarms.
 */
public abstract class FloatingDecimalProcessVariable extends NumericProcessVariable 
{
	/**
	 * Floating decimal PV constructor.
	 * @param name process variable name.
	 * @param eventCallback	event callback, can be null.
	 */
	public FloatingDecimalProcessVariable(String name, ProcessVariableEventCallback eventCallback)
	{
		super(name, eventCallback);
	}

	/**
	 * Get precision (number of digits after decimal point).
	 * Use -1 value as undefined precision.
	 * @return precision.
	 */
	public abstract short getPrecision();

	/**
	 * Set data (units, limits, ...) and precision to DBR.
	 * @param value DBR to fill-in.
	 */
	public void fillInDBR(DBR value)
	{
		super.fillInDBR(value);
		
		if (value.isPRECSION()) {
			// fill PRECISION
			PRECISION precision = (PRECISION)value;
			precision.setPrecision(getPrecision());
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy