FSNodeWriter¶
-
public class
FSNodeWriter
¶ Methods for FireSignal nodes. It is mostly a facade over CDBClient methods to simplify development of nodes that communicate directly with CDB. How to write a signal? 1) For each record, create an instance of FSNodeWriter (you have to know generic signal id as well). 2) Create a file using createDataFile(). (see variants of this method) 3) Write data (as many times as you want). a] Using writeData(). Please, notice that you have to be aware of the data offset in HDF5 (or write them in one step). b] If you have an existing HDF5 file, use copyHdf5(). 4) Tell DB that the file is ready using setFileReady(). (if you changed it) 5) Write all axes using writeAxis(index). index=0 for time axis, index=1,2,3,... for other axes. (can be called multiple times for the same axis). 6) Write signal using writeSignal().
Author: pipek
Methods¶
copyHdf5¶
createDataFile¶
-
public void
createDataFile
()¶ Create new data file (row in data_files).
Throws: - CDBException – In this default version, an already existing file with requested properties is taken as error.
createDataFile¶
-
public boolean
createDataFile
(boolean okIfExists, boolean createIfExists)¶ Create new data file (row in data_files).
Parameters: - okIfExists – If false, an exception is thrown if a file with the same collection name, data source and record number exists
- createIfExists – If true and a file already exists, create a new one (otherwise the existing one is returned).
Throws: Returns: true if a file was created, false if nothing happens.
getGenericSignal¶
-
public GenericSignal
getGenericSignal
()¶
setFileReady¶
-
public void
setFileReady
()¶ Tell CDB that you have finished writing data. After this, you cannot write more data.
setRequireChannelAttachment¶
-
public void
setRequireChannelAttachment
(boolean require)¶ Set whether writing should succeed (assuming value 1.0 for coefficients) when channel attachment not found. It has to be specified explicitely because it is quite probable that non-existence marks a bug.
writeAxis¶
-
public void
writeAxis
(int axis, double coefficient, double offset)¶ Write one of the axes.
Parameters: - axis – Index of the axis (0=time, 1,2,3,...=other axes)
writeData¶
-
public void
writeData
(Data data, long[] dataOffset)¶ Write data (with possible offset to append).
Parameters: - data – Data to be written.
- dataOffset – Zero-based index of the first data element. Size is calculated automatically. If data Offset is null, starts from beginning (fails with existing file and dataset).
Throws: