A.3. Tcl bindings to the C++ API

There are actually three distinct Tcl APIs:

Raw Tcl API

Encapsulates much of the C++ API. The missing pieces are event recording as this is not anticipated to be something done directly from Tcl. If this becomes needed, then let us know and we can consider adding that for a future release.

SpecTcl API

A package intended only for use in SpecTcl. Provides an API against which SpecTcl GUIs can be written to manage savesets. This also does not address recording event data.

Event recording API

This is intended only for use in SpecTcl and provides the API required to set up and tear dow the infrastructure needed to record event data to a saveset.

We will provide reference material for each of these in turn in separate subsections.

A.3.1. Raw Tcl API

Table of Contents
DBTcl -- Provide database access.
Database Instance -- Manipulate a database
Save set Instance -- Manipulate save sets

The raw API consists of three command ensembles.

DBTcl

This command ensemble provides the ability to create new databases and open existing databases.

Database instances

These command ensembles are dynamically created with unique base commands. When DBTcl opens a database, a new Database instance command ensemble is created and its base command returned to the application.

The Database instance ensembles can create and access save sets within the database.

Saveset instances

Saveset instances are also dynamically created command ensembles. When a Database instance command accesses a save set it generates a new ensemble with a unique command name.

Thus only the DBTcl command is a fixed command. You can think of Database instances and Saveste instances a objects whose subcommands are callable methods.

A.3.2. SpecTcl API

Table of Contents
dbconfig::makeSchema -- 
dbconfig::connect -- Connect to a database
dbconfig::openSaveSet -- Access a save set.
dbconfig::saveConfig -- Save SpecTcl analysis configuration
dbconfig::listConfigs -- Obtain information about save sets
dbconfig::restoreConfig -- Restore analysis configuration from saveset
dbconfig::saveSpectrum -- Save contents of a spectrum.
dbconfig::restoreSpectrum -- Restore spectrum contents from save set.
dbconfig::saveAllSpectrumContents -- Save the contents of all spectra to a saveset
dbconfig::restoreAllSpectrumContents -- Load channels for all spectra
dbconfig::listRuns -- List information about saved runs.
dbconfig::hasRun -- Determine if a save set has run data.
dbconfig::getRunInfo -- Get information about all runs in a saveset.
dbconfig::getScalers -- Return scaler information from a run.

The SpecTcl API contains procs that SpecTcl uses to access the database. While it provides a higher level model of the database, it makes extensive use of SpecTcl commands and therefore is highly SpecTcl specific.

The procs are defined in the dbconfig package and all are defined in the dbconfig namespace. This section provides reference information about these procs.

A.3.3. Event recording API

Table of Contents
daqdb -- Record/playback event data from sqlite3 database files

The event recording API consist of Tcl commands that allow clients to set up SpecTcl event recording into database save sets. When enabled, each time a begin run for a new run is seen, a new save-set is created, the current configuration saved to it, and events and scaler data are added to that saveset. The first time an end run record is encountered for a run, the end run time from that record is recorded and the contents of any spectrum marked for auto-save are saved.

The Event recording API has been subsumed into the SpecTclDB package. We supply reference documentation here to support user written graphical user interfaces that support event recording.