Package com.quanser.quarc.target
Interface ModelOutputListener
- All Superinterfaces:
EventListener
The listener interface for receiving model events. Methods of
this interface are invoked when the model is downloaded, when
the model is loaded or terminated and when the model writes to
its
stdout
or stderr
stream.-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is the first method called when the listener is added via theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method.void
consoleOutput
(String modelName, String text) This method is called when the model writes to stdout or stderr.void
modelDownloaded
(String modelName) This method is called when the model is downloaded.void
modelLoaded
(String modelName) This method is called when a model is loaded.void
modelLoading
(String modelName) This method is called when the model is about to load.void
modelTerminated
(String modelName, int exitCode) This method is called when the model has terminated.
-
Method Details
-
consoleInitialize
void consoleInitialize()This method is the first method called when the listener is added via theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method. It is only called once and may be used for initialization prior to the other methods of the interface being called. -
modelDownloaded
This method is called when the model is downloaded. It is not called if the model is already downloaded at the time theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method is called, although it will be called if the model is downloaded again.- Parameters:
modelName
- The name of the model
-
modelLoading
This method is called when the model is about to load. It is not called if the model is already loaded at the time theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method is called, although it will be called if the model is terminated and then reloaded.- Parameters:
modelName
- The name of the model
-
modelLoaded
This method is called when a model is loaded. It is not called if the model is already loaded at the time theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method is called, although it will be called if the model is terminated and then reloaded.- Parameters:
modelName
- The name of the model
-
consoleOutput
This method is called when the model writes to stdout or stderr. However, these streams are buffered for efficiency so afflush(stdout)
orfflush(stderr)
is required to force the output to be received before the buffer is full.- Parameters:
modelName
- The name of the modeltext
- The text written tostdout
orstderr
by the model
-
modelTerminated
This method is called when the model has terminated. It is not called if the model is already unloaded at the time theQUARCTarget.addModelOutputListener(java.lang.String, com.quanser.quarc.target.ModelOutputListener)
method is called, although it will be called if the model is loaded and then terminates again.- Parameters:
modelName
- The name of the modelexitCode
- The exit code of the model process
-