gmSCDataTableClass

The DataTable Service Class

The service class DataTable uses the Write and DataQueue classes to produce structured tabular reports using the content of the runtime data queue. The reports themselves can be produced in one of three outputStyles: simple tab delimited, text tabular, or html tabular. Complex reports, especially tables, are laid out explicitly and thus can only be written in one style. This class also contains those methods needed to produce boxed tabular reports.

The method DataTable_ClearBottom

Prototype


void DataTable_ClearBottom(void)
The DataTable_ClearBottom method checks to see if there is a bottom mark at the current top of the data queue. If there is not, then the message "SYSTEM ERROR#10009: Queue not at bottom mark, top=%d" is logged and control is returned to the operation system.

The method has no parameters or return value.

The method DataTable_SetBottom

Prototype


void DataTable_SetBottom(void);
The DataTable_SetBottom method marks the current spot in the queue as the current bottom. Any attempt to pop value from the queue will fail until this mark is cleared. This method is needed to block any interference between the DataTable class and the other classes using the data queue.

The method has no parameters or return value.

The method DataTable_WriteTitle

Prototype


void DataTable_WriteTitle(void);
The DataTable_WriteTitle method writes a title for a table of values along with other control information that may be needed to begin the actual table display to the currently active output stream using the form required by the Output Syntax attribute set for it. The title itself is stored on the runtime data queue prior to the call to this method. Note that tab files do not get a title as they are typically used for data input.

The method has no parameters or return value.

The method DataTable_DefineColumn

Prototype


void DataTable_DefineColumn(char* heading, int width);
The DataTable_DefineColumn method sets up the call to the method DataTable_WriteHeadings which expects the find a series of (String, Integer) pairs in the data queue. The number of pairs defines the number of columns in the table. Its parameters are as follows:

Parameter Description
heading Contains the actual heading to be used for the column being defined.
width Specifies the field width and orientation to be used as follows:

Width Meaning
+n Right justify the characters in a cell n characters wide.
-n Left justify the characters in a cell n characters wide.


These values are actually only used when the Output Syntax is Text; however, since this syntax choice does not take effect until runtime, the columns should always be supplied with reasonable values. Note that the method checks to make certain that the width of the heading is not larger than the column width. If so, it resets the column width.

The method DataTable_WriteHeadings

Prototype


void DataTable_WriteHeadings(void);
The DataTable_WriteHeadings method writes a column heading to the currently active tabular display using the table style specified when the table display was started. The heading and their desired widths themselves are stored in the runtime data queue via the method DataTable_DefineColumn.

This method has no parameters or return value.

The method DataTable_WriteCell

Prototype


void DataTable_WriteCell(void);
The DataTable_WriteCell method writes the current table cell. In many complex output situations it is often desirable to nest the output support utilities so that complex outputs can be nested within each other or can be constructed with independent sets of logic. This method allows for the writing of complex data cells within data tables. Rather than writing the current output record and thus clearing its internal buffers so that another record can be written, this method pushes the content of the internal buffer onto the runtime data queue and then clears the buffer.

The method has no parameters or return value.

The method DataTable_WriteRow

Prototype


void DataTable_WriteRow(void);
The DataTable_WriteRow method writes a data row to the currently active data table using the table style specified when the table display was started. The cell content making up the data raw are stored as strings on the runtime data queue.

The method has no parameters or return value.

The method DataTable_WriteEnd

Prototype


void DataTable_WriteEnd(void);
The DataTable_WriteEnd method writes the end portion of an html data table and ends the centering associated with it. For other output styles it does nothing.

The method has no parameters or return value.

The method DataTable_WriteOpen

Prototype


void DataTable_WriteOpen(void);
The DataTable_WriteOpen method writes the page opening portion of an html page that will be containing data tables. For other output styles it does nothing.

The method has no parameters or return value.

The method DataTable_WriteClose

Prototype


void DataTable_WriteClose(void);
The DataTable_WriteClose method writes the page closing portion of an html page that was being used to contain data tables. For other output styles it does nothing.

The method has no parameters or return value.

Table of Contents