US Statistical Report Suite: Derived Reporting Classes

Each report in the US Statistical Report Suite is generated by a seperate report generating class object. All the report generating classes are derived from the base class us_state_report_generator. The number of report generating classes, and reports, will be increasing soon, so check back periodically for more report samples.

The report generating classes will generate one of three types of reports.

  • State Reports in which the report lists all the states in one list.
  • Divisional Reports in which the states are grouped by division.
  • Regional Reports in which the states are grouped by region.

The following report classes are currently available in the report suite, with more on the way soon.

Each report class overrides a number of virtual functions declared in the base class. The base class contains a template method, which calls these overridden functions to create the report. The functions are named according to the actions they perform. The following discusses details on some of the common overridden functions present in all report classes.

The create_header() operation has the responsibility of creating the header for the report. You will see a few different header styles in the various reports. Like all other operations, the manner which the headers are created will also differ, to demonstrate the various ways Xport can be used to achieve the same result.

The create_report_body() operation is responsible for creating the body of the report, which is everything between the report header and the report footer. This operation usually calls on other functions to divide the workload. Normally, tables are used to display the state data in tabular form.

The create_footer() operation is responsible for creating a footer for the report. Sometimes the footer will include a link to the Xport site, or an appropriate message about how Xport was used to create the report and stylesheet.

The create_stylesheet() operation is responsible for creating the stylesheet for the report. The stylesheet object is passed as a parameter to this function. The stylesheet object is then populated with the various stylesheet rules and declarations for the report. The stylesheets created for the reports in the report suite are all external stylesheets, and are written to the same path where the associated reports are placed.

The report_dir() operation returns the subdirectory name in which the report document and stylesheet are to be placed, and the report_name() operation returns the name of the report and stylesheet. Just the name, and not the extention will be returned. The calling function will give the report a htm extension, and give the stylesheet a css extension.

To create a report from a given derived report generating class object, the class object is created, then the operation generate_report() is called with two arguments, the document object, and the stylesheet object, both which will be populated. The following snippet will generate an xhtml strict document and stylesheet for the state area report.

  document doc;
  stylesheet ss;
  xport_samples::state_area_report_generator myReportGenerator;
  myReportGenerator.generate_report(doc, ss);

Each report in the report suite has it's own page. On this page, the report can be viewed, as well as the report's xhtml source and stylesheet. Also, the report generating class itself can be viewed, in the classes header and cpp files.

Work Time Studio

Datasoft Solutions is proud to present their landmark product, Work Time Studio. Utilizing the tree container library, Work Time Studio provides unparalleled features in personal time, project and task management software. If you're looking for a way to increase your productivity, visit Work Time Studio's product website, and start being more productive today.