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 * Get chunking 028 * @return chunks (can be null) 029 */ 030 public int[] getChunking(); 031 032 /** 033 * Set chunking 034 * @param chunks chunk shape 035 */ 036 public void setChunking(int... chunks); 037 038 /** 039 * Set saver 040 * @param saver lazy saver 041 */ 042 public void setSaver(ILazySaver saver); 043 044 /** 045 * Set a slice of the dataset 046 * 047 * @param monitor can be null 048 * @param data input 049 * @param slice an n-D slice 050 * @throws DatasetException when cannot write data 051 */ 052 public void setSlice(final IMonitor monitor, final IDataset data, final SliceND slice) throws DatasetException; 053 054 /** 055 * Set a slice of the dataset 056 * 057 * @param monitor can be null 058 * @param data input 059 * @param start 060 * specifies the starting indexes (can be null for origin) 061 * @param stop 062 * specifies the stopping indexes (can be null for end) 063 * @param step 064 * specifies the steps in the slice (can be null for unit steps) 065 * @throws DatasetException when cannot write data 066 */ 067 public void setSlice(final IMonitor monitor, final IDataset data, final int[] start, final int[] stop, final int[] step) throws DatasetException; 068 069 /** 070 * Set a slice of the dataset synchronously 071 * 072 * @param monitor can be null 073 * @param data input 074 * @param slice an n-D slice 075 * @throws DatasetException when cannot write data 076 */ 077 public void setSliceSync(final IMonitor monitor, final IDataset data, final SliceND slice) throws DatasetException; 078 079 /** 080 * Set writing slices as asynchronous 081 * @param async true if writing should be asynchronous 082 */ 083 public void setWritingAsync(boolean async); 084 085 /** 086 * Get the value used to fill an un-initialized dataset 087 * @return fill value 088 */ 089 public Object getFillValue(); 090 091 /** 092 * Set the value used to fill an un-initialized dataset 093 * @param fill value 094 */ 095 public void setFillValue(Object fill); 096 097 @Override 098 public ILazyWriteableDataset squeezeEnds(); 099}