Class for printing tables to the console output. More...
#include <SystemPrinter.h>
Public Member Functions | |
SystemPrinter (const RelationAttributeInfo *attributes, int count) | |
Constructor for SystemPrinter. | |
SystemPrinter (const char *relName, const AttributeInfo *attributes, int count) | |
Constructor for SystemPrinter. | |
~SystemPrinter () | |
Destructor for SystemPrinter. | |
void | printHeader () |
Prints a header for the table. | |
void | printRecord (const char *data) |
Prints a record (tuple). | |
void | printFooter () |
Prints footer information. |
Class for printing tables to the console output.
Class for printing records of a table one at a time. This class must be used by your SystemManager::info and SystemManager::print methods, and it will be required for some QueryEngine methods as well.
SystemPrinter::SystemPrinter | ( | const RelationAttributeInfo * | attributes, | |
int | count | |||
) |
Constructor for SystemPrinter.
attributes | Array of <attribute, relation name> pairs | |
count | Length of the array |
Constructor for SystemPrinter. Creates a deep copy of the array of RelationAttributeInfo structures. These will be used to print the header information, as well as to interpret the contents of records during calls to SystemPrinter::printRecord. This version of the constructor is useful when printing tables corresponding to query results (when different attributes may be associated with different relations).
SystemPrinter::SystemPrinter | ( | const char * | relName, | |
const AttributeInfo * | attributes, | |||
int | count | |||
) |
Constructor for SystemPrinter.
relName | The name of the relation | |
attributes | Array of attribute descriptors | |
count | Length of the array |
Constructor for SystemPrinter. Creates a deep copy of the array of RelationAttributeInfo structures. These will be used to print the header information, as well as to interpret the contents of records during calls to SystemPrinter::printRecord. This version of the constructor is useful when printing base tables (where each attribute is associated with the same relation).
void SystemPrinter::printFooter | ( | ) |
Prints footer information.
This method prints to stdout footer information about the number of records printed via calls to SystemPrinter::printRecord. This method should be called once, after the last record has been printed.
void SystemPrinter::printHeader | ( | ) |
Prints a header for the table.
This method prints header information to stdout. Each attribute name is printed, along with its relation name. A row of dashes is then printed. This method should be called once, before printing any actual tuples.
void SystemPrinter::printRecord | ( | const char * | data | ) |
Prints a record (tuple).
data | A pointer to the record data |
Prints a record to stdout, using the typing information supplied by the RelationalAttributeInfo array passed to the class constructor. The length of the array of bytes pointed to be the data parameter should be the sum of the lengths of the attributes in that array.