UltraScan III
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes
US_Report Class Reference

#include "us_report.h"

Collaboration diagram for US_Report:
Collaboration graph
[legend]

Classes

class  ReportDocument
 The ReportDocument class describes an individual report document. This document would be a png or an html snippet that could be included as one of many documents available to be a part of a report. More...
 
class  ReportTriple
 The ReportTriple class describes an individual report. This report would ordinarily be associated with a particular runID and triple ( c/c/w ) within the experiment, and could contain any number of report documents. More...
 
class  ReportTypes
 Map report types: name-to-label and name-to-mimetype. More...
 

Public Types

enum  Status {
  REPORT_OK, NOT_FOUND, CONNECT_ERROR, DB_ERROR,
  MISC_ERROR, SAVED_DB
}
 Some status codes to keep track of latest conditions. More...
 

Public Member Functions

 US_Report ()
 Generic constructor for the US_Report class. More...
 
 ~US_Report ()
 A destructor. More...
 
Status readDB (QString, US_DB2 *=0, QString="")
 Function to read an entire report structure from the DB, except for the document content itself. More...
 
Status saveDB (US_DB2 *=0)
 Function to save the global report information to db. More...
 
Status addTriple (QString, QString="", US_DB2 *=0)
 Function to add a new empty triple record to the report. More...
 
Status addTriple (US_Report::ReportTriple, US_DB2 *=0)
 Function to add or replace an entire triple. More...
 
Status saveAllToDB (QString, US_DB2 *=0)
 Function to save the entire report structure to db. More...
 
Status removeTriple (int, US_DB2 *=0)
 Function to delete a report triple from the DB, along with all documents. More...
 
int findTriple (QString)
 Function to locate a triple record using the triple string. More...
 
Status saveDocumentFromFile (const QString &, const QString &, US_DB2 *, int=1, const QString="")
 Store a single reportDocument record based on filename info. More...
 
Status saveFileDocuments (const QString &, const QStringList &, US_DB2 *, int=1, const QString="")
 Store multiple reportDocument records from the same triple. More...
 
Status removeReport (int, US_DB2 *=0)
 Function to delete the specified report from the DB. More...
 
void reset ()
 Resets the class variables to default values. More...
 
void show (void)
 Displays the contents of the class variables in qDebug()'s. More...
 

Public Attributes

int ID
 The ID of this global report structure. More...
 
QString GUID
 The GUID of this global report structure. More...
 
int experimentID
 The experimentID from which triple is derived. More...
 
QString runID
 The runID that identifies this experiment. More...
 
QString title
 The title of the report. More...
 
QString html
 
QVector< ReportTripletriples
 The report triple. More...
 
ReportTypes rTypes
 Persistent structure of report type mappings. More...
 

Private Attributes

int dbg_level
 Debug level value. More...
 

Detailed Description

This class provides a low-level interface to the report tables, allowing the user to read and write them to db.

Definition at line 17 of file us_report.h.

Member Enumeration Documentation

Some status codes to keep track of latest conditions.

Enumerator
REPORT_OK 

The last db operation completed successfully.

NOT_FOUND 

The report, reportTriple or reportDocument ID/GUID was not found.

CONNECT_ERROR 

Could not connect to the DB.

DB_ERROR 

A US_DB2 error occurred; check db->lastErrno();.

MISC_ERROR 

An unspecified error occurred.

SAVED_DB 

The report has been saved to the DB.

Definition at line 23 of file us_report.h.

Constructor & Destructor Documentation

US_Report::US_Report ( )

Generic constructor for the US_Report class.

Definition at line 486 of file us_report.cpp.

US_Report::~US_Report ( )
inline

A destructor.

Definition at line 212 of file us_report.h.

Member Function Documentation

US_Report::Status US_Report::addTriple ( QString  triple,
QString  dataDescription = "",
US_DB2 db = 0 
)

Function to add a new empty triple record to the report.

Parameters
tripleThe triple identifying which channel
dataDescriptionThe data description from the original file
dbFor database access, an open database connection
Returns
One of the US_Report error codes

Definition at line 654 of file us_report.cpp.

US_Report::Status US_Report::addTriple ( US_Report::ReportTriple  t,
US_DB2 db = 0 
)

Function to add or replace an entire triple.

Parameters
tA US_Report::ReportTriple object
dbFor database access, an open database connection
Returns
One of the US_Report error codes

Definition at line 668 of file us_report.cpp.

int US_Report::findTriple ( QString  searchTriple)

Function to locate a triple record using the triple string.

Parameters
searchTripleThe triple identifying which channel
Returns
The index into the QVector triples that matches the triple string, or -1 if no match

Definition at line 706 of file us_report.cpp.

US_Report::Status US_Report::readDB ( QString  new_runID,
US_DB2 db = 0,
QString  new_triple = "" 
)

Function to read an entire report structure from the DB, except for the document content itself.

Parameters
new_runIDThe runID of the associated experiment
dbFor database access, an open database connection
new_tripleThe triple string for associated documents
Returns
One of the US_Report error codes

Definition at line 492 of file us_report.cpp.

US_Report::Status US_Report::removeReport ( int  reportID,
US_DB2 db = 0 
)

Function to delete the specified report from the DB.

Parameters
reportIDThe database reportID of the report to delete
dbFor database access, an open database connection

Definition at line 1025 of file us_report.cpp.

US_Report::Status US_Report::removeTriple ( int  ndx,
US_DB2 db = 0 
)

Function to delete a report triple from the DB, along with all documents.

Parameters
ndxThe index into the triples QVector of the report triple to delete
dbFor database access, an open database connection
Returns
One of the US_Report error codes

Definition at line 687 of file us_report.cpp.

void US_Report::reset ( void  )

Resets the class variables to default values.

Definition at line 1076 of file us_report.cpp.

US_Report::Status US_Report::saveAllToDB ( QString  dir,
US_DB2 db = 0 
)

Function to save the entire report structure to db.

Parameters
dirThe directory where the document contents file is located
dbFor database access, an open database connection
Returns
One of the US_Report error codes

Definition at line 1043 of file us_report.cpp.

US_Report::Status US_Report::saveDB ( US_DB2 db = 0)

Function to save the global report information to db.

Definition at line 561 of file us_report.cpp.

US_Report::Status US_Report::saveDocumentFromFile ( const QString &  dir,
const QString &  filename,
US_DB2 db,
int  idEdit = 1,
const QString  dataDescription = "" 
)

Store a single reportDocument record based on filename info.

Parameters
dirThe directory where the report file is located. The is required to end with the runID, e.g., dir = "/home/user/ultrascan/reports/demo1_veloc"
filenameBase file name of the local report document file. This file should be named as follows: analysis.triple.subAnalysis.docType — e.g., 2dsa.2A260.tinoise.svg
dbFor database access, an open database connection
idEditID of EditedData with which document is associated.
dataDescriptionThe data description from the first line of the original file, in case adding new triple
Returns
One of the US_Report error codes

Definition at line 722 of file us_report.cpp.

US_Report::Status US_Report::saveFileDocuments ( const QString &  dir,
const QStringList &  filepaths,
US_DB2 db,
int  idEdit = 1,
const QString  dataDescription = "" 
)

Store multiple reportDocument records from the same triple.

Parameters
dirThe directory where the report file is located. The is required to end with the runID, e.g., dir = "/home/user/ultrascan/reports/demo1_veloc"
filepathsBase file paths of the local report document files. These file should be named as follows: analysis.triple.subAnalysis.docType — e.g., 2dsa.2A260.tinoise.svg
dbFor database access, an open database connection
idEditID of EditedData with which docs are associated.
dataDescriptionThe data description from the first line of the original file, in case adding new triple
Returns
One of the US_Report error codes

Definition at line 852 of file us_report.cpp.

void US_Report::show ( void  )

Displays the contents of the class variables in qDebug()'s.

Definition at line 1090 of file us_report.cpp.

Member Data Documentation

int US_Report::dbg_level
private

Debug level value.

Definition at line 305 of file us_report.h.

int US_Report::experimentID

The experimentID from which triple is derived.

Definition at line 200 of file us_report.h.

QString US_Report::GUID

The GUID of this global report structure.

Definition at line 199 of file us_report.h.

QString US_Report::html
          Some introductory html that would appear 

at the top of the report

Definition at line 203 of file us_report.h.

int US_Report::ID

The ID of this global report structure.

Definition at line 198 of file us_report.h.

ReportTypes US_Report::rTypes

Persistent structure of report type mappings.

Definition at line 206 of file us_report.h.

QString US_Report::runID

The runID that identifies this experiment.

Definition at line 201 of file us_report.h.

QString US_Report::title

The title of the report.

Definition at line 202 of file us_report.h.

QVector< ReportTriple > US_Report::triples

The report triple.

Definition at line 205 of file us_report.h.


The documentation for this class was generated from the following files: