Class DefaultScannableNexusDevice<N extends NXobject>
- Type Parameters:
N- this type variable is irrelevant in this implementation asAbstractScannableNexusDevice.getNexusProvider(NexusScanInfo)is not called. InsteadgetNexusProviders(NexusScanInfo)returns multipleNexusObjectProviders which may create different types of nexus object.
- All Implemented Interfaces:
IGDAScannableNexusDevice<N>,INexusDevice<N>,IWritableNexusDevice<N>
Scannable to implement INexusDevice in order to create one or more
nexus objects to add to the nexus tree. This class is the default implementation of INexusDevice
for a Scannable and will be used if either no ScannableNexusDeviceConfiguration is defined.
The nexus writing framework calls the method getNexusProviders(NexusScanInfo) which returns
a NexusObjectProvider for each nexus object to be added to the tree. See the Javadoc for that method
for details.
- See Also:
-
Field Summary
Fields inherited from class gda.data.scan.nexus.device.AbstractScannableNexusDevice
nexusRoleFields inherited from class gda.data.scan.nexus.device.AbstractNexusDeviceAdapter
DOUBLE_DATA_BYTE_SIZEFields inherited from interface org.eclipse.dawnsci.nexus.IWritableNexusDevice
SCALAR_DATASET_SHAPE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultScannableNexusDevice(Scannable scannable) DefaultScannableNexusDevice(Scannable scannable, boolean writeDemandValue) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateDataNodes(NexusScanInfo scanInfo) Creates the data fields for the nexus object.protected NexusObjectProvider<N> createNexusProviderForInputField(String inputName, int fieldIndex, NexusScanInfo.ScanRole scanRole, boolean isSingleField) Returns an object that performs a custom modification to anNXentry.The number and type of these depends on the number of input names and extra names the scannable has, as returned byScannable.getInputNames()andScannable.getExtraNames()as follows.voidscanEnd()Called at the end of a scan.voidsetWriteDemandValue(boolean writeDemandValue) protected booleanshouldWriteDemandValue(NexusScanInfo scanInfo) writePosition(Object demandPosition, IPosition scanPosition) Methods inherited from class gda.data.scan.nexus.device.AbstractScannableNexusDevice
addFields, createLazyWritableDataset, createNexusObject, getFieldDataNode, getFieldNames, getFieldUnits, getNexusBaseClass, getNexusCategory, getNexusProvider, getPrimaryDataFieldIndex, getPrimaryDataFieldName, getScannable, isNexusObjectCreated, setScanObject, toString, writeControllerRecordName, writePositionMethods inherited from class gda.data.scan.nexus.device.AbstractNexusDeviceAdapter
addAttributesToDataNode, configureNexusWrapper, createNexusProvider, getDevice, getFillValue, getName, registerAttributesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.dawnsci.nexus.INexusDevice
register
-
Constructor Details
-
DefaultScannableNexusDevice
-
DefaultScannableNexusDevice
-
-
Method Details
-
setWriteDemandValue
public void setWriteDemandValue(boolean writeDemandValue) -
shouldWriteDemandValue
-
getNexusProviders
The number and type of these depends on the number of input names and extra names the scannable has, as returned byScannable.getInputNames()andScannable.getExtraNames()as follows.- For a scannable with a single input name, a
Listcontaining a singleNexusObjectProvideris created. This contains anNXpositionerwith aNXpositioner.NX_VALUEDataNodefor the single input name, and additional data nodes for each extra name (with that name). - For a scannable with multiple input names, the list will contain multiple
NexusObjectProviders:- A
NexusObjectProviderfor each input name, containing anNXpositionerwith aNXpositioner.NX_VALUEDataNodefor the input name - A
NexusObjectProvidercontaining anNXcollectionwith the the sameDataNodes for each input name ontained in theNXpositioners, but here each data name within the collection will be the input name that it is the data node for. Additionally the collection contains a data node for each extra name (with that name).
- A
- Parameters:
info- information about the scan which can be useful when creating datasets e.g.info.getRank()- Returns:
- The
NXobjectcreated using thenodeFactoryto represent this device - Throws:
NexusException- if the nexus object could not be created for any reason
- For a scannable with a single input name, a
-
createDataNodes
Description copied from class:AbstractScannableNexusDeviceCreates the data fields for the nexus object. These are theDataNodes - and the datasets that they contain - for each of the fields returned byScannable.getInputNames()andScannable.getExtraNames(). If the wrapped scannable is a metadata scannable these datasets will beIDatasets containing a single scalar value from the position returned byScannable.getPosition()(turned into an array by {#getPositionArray()}, otherwise they will beILazyWriteableDatasets, which will be written into during each call toAbstractScannableNexusDevice.writePosition(Object, IPosition)} Create the DataNodes for theScannable.- Overrides:
createDataNodesin classAbstractScannableNexusDevice<N extends NXobject>- Parameters:
scanInfo-- Throws:
NexusException
-
createNexusProviderForInputField
protected NexusObjectProvider<N> createNexusProviderForInputField(String inputName, int fieldIndex, NexusScanInfo.ScanRole scanRole, boolean isSingleField) throws NexusException - Throws:
NexusException
-
writePosition
- Overrides:
writePositionin classAbstractScannableNexusDevice<N extends NXobject>- Throws:
Exception
-
getCustomNexusModification
Description copied from interface:INexusDeviceReturns an object that performs a custom modification to anNXentry.NOTE: Use this method with caution as it can be used to break the central design concept of the new Nexus writing framework, namely that the nexus framework itself knows where to put the nexus groups for devices and build any required
NXdatagroups. It is currently used by the new Nexus framework to partially support legacy GDA8 spring configurations, in particular the 'locationmap'.The nexus framework will call this method after
, so this method create links to nodes created in that method if appropriate.invalid reference
#createNexusObject(NexusNodeFactory, NexusScanInfo)The easiest way to implement this method is to make this object itself also implement
CustomNexusEntryModification. This method can then be overridden to simply returnthis.- Returns:
- a
CustomNexusEntryModificationthat makes a custom modification, ornullif this device should not make custom modifications
-
scanEnd
Description copied from interface:IWritableNexusDeviceCalled at the end of a scan. The implementation should use this to clear up any state, such as closing any files and releasing any cached datasets so that this device can be used in subsequent scans.- Specified by:
scanEndin interfaceIWritableNexusDevice<N extends NXobject>- Overrides:
scanEndin classAbstractScannableNexusDevice<N extends NXobject>- Throws:
NexusException- if an error occurred for any reason
-