001/*-
002 * Copyright 2015, 2016 Diamond Light Source Ltd.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 */
009
010package org.eclipse.january.dataset;
011
012import org.eclipse.january.DatasetException;
013import org.eclipse.january.IMonitor;
014import org.eclipse.january.io.ILazySaver;
015
016/**
017 * This sub-interface adds the ability to write to a lazy dataset slice-by-slice
018 */
019public interface ILazyWriteableDataset extends IDynamicDataset {
020
021        /**
022         * See {@link IDynamicDataset#UNLIMITED}
023         */
024        public static final int UNLIMITED = IDynamicDataset.UNLIMITED;
025
026        /**
027         * Set saver
028         * @param saver lazy saver
029         */
030        public void setSaver(ILazySaver saver);
031
032        /**
033         * Set a slice of the dataset
034         * 
035         * @param monitor can be null
036         * @param data input
037         * @param slice an n-D slice
038         * @throws DatasetException when cannot write data
039         */
040        public void setSlice(final IMonitor monitor, final IDataset data, final SliceND slice) throws DatasetException;
041
042        /**
043         * Set a slice of the dataset
044         * 
045         * @param monitor can be null
046         * @param data input
047         * @param start
048         *            specifies the starting indexes (can be null for origin)
049         * @param stop
050         *            specifies the stopping indexes (can be null for end)
051         * @param step
052         *            specifies the steps in the slice (can be null for unit steps)
053         * @throws DatasetException when cannot write data
054         */
055        public void setSlice(final IMonitor monitor, final IDataset data, final int[] start, final int[] stop, final int[] step) throws DatasetException;
056
057        /**
058         * Set a slice of the dataset synchronously
059         * 
060         * @param monitor can be null
061         * @param data input
062         * @param slice an n-D slice
063         * @throws DatasetException when cannot write data
064         */
065        public void setSliceSync(final IMonitor monitor, final IDataset data, final SliceND slice) throws DatasetException;
066
067        /**
068         * Set writing slices as asynchronous
069         * @param async true if writing should be asynchronous
070         */
071        public void setWritingAsync(boolean async);
072
073        /**
074         * Get the value used to fill an un-initialized dataset
075         * @return fill value
076         */
077        public Object getFillValue();
078
079        /**
080         * Set the value used to fill an un-initialized dataset
081         * @param fill value
082         */
083        public void setFillValue(Object fill);
084
085        @Override
086        public ILazyWriteableDataset squeezeEnds();
087}