Supported arguments, Threading, Sample code – Ocean Optics SpectraSuite User Manual
Page 117
8: Tools Menu Functions
000-20000-300-02- 201110
105
Supported Arguments
Currently, functions may take either of the following as arguments:
A single integer: When you set up the triggering in SpectraSuite to call your function, you will
supply the value for the integer that is passed to your function.
A spectrum: This will consist of three arguments – an array of wavelength values, an array of pixel
values, and an integer denoting the length of the wavelength/pixel value arrays. When you set up the
triggering in SpectraSuite to call your function, you will be prompted with a list of currently-running
acquisitions and asked to select which acquisition the wavelength and pixel values should be taken
from. When the function is called, the most recent wavelength and pixel values will be taken from
the acquisition you chose and passed as arguments to your function.
Threading
If you have trouble getting SpectraSuite to call a function more than once, you need to know that
SpectraSuite calls your library’s function in new thread and waits for the thread to return before it will
call your library’s function again. The feature was designed this way to prevent large amounts of memory
from being used. Therefore, it is important to make sure that your function will return, or it won’t be
called again.
Sample Code
Examples of Java classes that contain a method that can be invoked are as follows:
// A class with a method that takes an integer as an argument
public class
IntegerTestClass {
// Constructor
public
IntegerTestClass() {
// initialization code goes here
}
public void
run(
int
argument) {
// handling code here
}
}
// A class with a method that takes a spectrum as an argument
public class
SpectrumTestClass {
// Constructor
public
SpectrumTestClass () {
// initialization code goes here
}
public void
run(
double
[] wavelengths,
double
[] pixels,