package signals;


import java.io.IOException;
import base.DataMatrix;
import descriptors.SignalDesc;

/** Generic Signal. Superclass of PPF/JPF etc
 * 
 * This is almost just DataMatrix but also holds it's own descriptor
 * since thats what makes it 'a signal'
 * 
 * @author oliford <codes@oliford.co.uk>
 */
public abstract class Signal extends DataMatrix{

	
	public Signal(String fileName) throws IOException { super(fileName); }
	public Signal(int rank) { super(rank); }
	public Signal() { super(); }
	public Signal(Object data) { super(data); }
	public Signal(Object data , Object[] coords) { super(data, coords); }
	
	
	/** Save signal to appropriate place in directory 'cacheRoot' */
	public void writeToCache(String cacheRoot) throws IOException {
		String fileName = cacheRoot + "/" + getDescriptor().path() + ".hdf";
		writeToHD5(fileName);
	}
	
	/** Save signal to appropriate place in directory 'cacheRoot' */
	public void writeToCacheE(String cacheRoot) throws IOException {
		String fileName = cacheRoot + "/" + getDescriptor().path() + "E.hdf";
		writeToHD5(fileName);
	}
	
	public abstract SignalDesc getDescriptor();
}
