Skip to content
Snippets Groups Projects
Commit e98547e3 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

1st version of block data reading

parent fb259af8
No related branches found
No related tags found
No related merge requests found
......@@ -56,23 +56,6 @@ public abstract class ReferencedData {
protected abstract String getDataName();
/**
* Prepares everything necessary before threaded multiple data reading
*/
public void prepareForMultiReading() {
ICDMAReader reader = getReader();
if (reader != null) {
IDataItem item = reader.getDataItem(contextDataItem);
if (item != null) {
try {
item.prepareForMultiReading();
} catch (DataAccessException e) {
Factory.getLogger().error("Failed to prepare " + getDataName() + " for multiple reading", e);
}
}
}
}
/**
* Finalizes what has to be finalized after threaded multiple data reading
*/
......
......@@ -3,7 +3,10 @@ package fr.soleil.cdma.box.data;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicLong;
import org.cdma.Factory;
import org.cdma.dictionary.LogicalGroup;
import org.cdma.exception.DataAccessException;
import org.cdma.interfaces.IDataItem;
import org.cdma.interfaces.IKey;
import org.cdma.utils.MetricsUtils;
import org.slf4j.LoggerFactory;
......@@ -166,4 +169,26 @@ public abstract class StackedData extends ReferencedData {
return result;
}
/**
* Prepares everything necessary before threaded multiple data reading and returns the number of data that can be
* read in a block.
*
* @return The number of data that can be read in a block.
*/
public int prepareForMultiReading() {
int dataPerBlock = 1;
ICDMAReader reader = getReader();
if (reader != null) {
IDataItem item = reader.getDataItem(contextDataItem);
if (item != null) {
try {
dataPerBlock = item.prepareForMultiReading(getDataRank());
} catch (DataAccessException e) {
Factory.getLogger().error("Failed to prepare " + getDataName() + " for multiple reading", e);
}
}
}
return dataPerBlock;
}
}
......@@ -410,12 +410,14 @@ public class ScanData {
// }
/**
* Prepares everything necessary before threaded multiple images reading
* Prepares everything necessary before threaded multiple images reading and returns the number of images that can
* be read in a block.
*
* @return The number of images that can be read in a block.
*/
public void prepareImageStackForMultipleReading() {
if (images != null) {
images.prepareForMultiReading();
}
public int prepareImageStackForMultipleReading() {
return images == null ? 0 : images.prepareForMultiReading();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment