![]() | ![]() | ![]() | Initialization flow control | ![]() |
To understand where to add code to modify the behavior of Readout you must understand how Readout initializes. The figure below is a flowchart of this initialization process.
After command line switches are parsed and decoded, Experiment initialization takes place. This involves creating a CExperiment object and initializing its elements. All initialization of CExperiment are done in the context of the main thread.
Normally, CReadoutMain is subclassed, and you override two member functions to initialize the CExperiment object for your application.
These functions are:
Interpreter setup is slightly more complex because the interpreter runs in a separate thread. The Readout initialization software first checks for the presence of the --window switch. If present, a Tk interpreter is started off, if not, a Tcl interpreter.
Regardless of the interpreter started, it retains a object of CInterpreterCore. That object is responsible for registering all extensions to the command interpreter. After registering the standard extensions, in order it invokes three CReadoutMain member functions to allow the user to add any interpreter extensions requried by the application. These member functions are called in the context of the Interpreter thread. The CReadoutMain functinos called are virtual functions that can be overridden by the user to supply extensions without modifying the source of the framework.
The functions called are:
Once all extensions have been initialized, if the --port switch specified a TclServer port, Readout will initiate a thread to listen for TclServer client connections. This sequence of operations ensures that by the time the first TclServer connections are honored and the Tcl/Tk interpreter prompt is issued to stdin, all standard and application specific extensions have been initialized and installed in the interpreter.
![]() | ![]() | ![]() | Initialization flow control | ![]() |