Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

SctArchiving::IOManagerDB Class Reference

This IOManager reads from and writes to a database. More...

#include <IOManagerDB.h>

Inheritance diagram for SctArchiving::IOManagerDB:

Inheritance graph
[legend]
Collaboration diagram for SctArchiving::IOManagerDB:

Collaboration graph
[legend]

Public Member Functions

virtual void write (const Sct::Serializable &ob, const Sct::IOParams *params=0) const
 write using default streamers

virtual shared_ptr< Sct::Serializableread (const string &name, const Sct::IOParams *params=0) const
 read using appropriate streamers

virtual std::string status () const
 get some status information

virtual void addRun (unsigned long runNumber)
 Add a run - gets location identifier from getLocationIdentifier.

virtual bool runExists (unsigned long runNumber)
 Returns true if run already exists.

virtual void addTest (const TestData &testdata, bool alsoAddScans)
 Add a test.

virtual bool testExists (const TestData &testdata)
 check if scan exists

virtual void addScan (const TestData &testdata, unsigned scanNumber)
 Add a scan.

virtual bool scanExists (const TestData &testdata, unsigned scanNumber)
 check if scan exists

virtual std::string getLocationName ()
 get string identifying data set e.g.

virtual void setLocationName (const std::string &locationName)

Static Public Member Functions

IOManagerDBinstance ()
 retrieve access to singleton

std::string convertToMysqlDateTimeFormat (const std::string &isotime)
 conversion just removes 'T' from isotime


Private Member Functions

void checkForErrors (const string &msg, const string &file, int line)
 throw MysqlException if there is an error in the mysql object

void checkForErrors (const string &msg, const string &query, const string &file, int line)
 throw MysqlException if there is an error in the mysql object - listing query

 IOManagerDB ()
 constructor.


Static Private Member Functions

const SctData::ResultHeadergetHeader (const Sct::Serializable &ob)
 get the header from a TestResult or ScanResult

std::string getTable (const Sct::Serializable &ob)
 find the name of the table which the ob should to into.


Private Attributes

boost::shared_ptr< ZlibStringCompressorm_compressor
 keep a string compressor handy to zip and unzip BLOB data.

MYSQL * m_mysql
 the main MYSQL object

std::string m_locationName

Static Private Attributes

IOManagerDBs_man
 pointer to singleton


Detailed Description

This IOManager reads from and writes to a database.

It is expected to be used in archival, and so also makes use of streamer versioning by inheriting from IOManagerStreamerVersioned. Uses a mysql back-end.

Definition at line 34 of file IOManagerDB.h.


Constructor & Destructor Documentation

SctArchiving::IOManagerDB::IOManagerDB  )  [private]
 

constructor.

Definition at line 62 of file IOManagerDB.cpp.

References checkForErrors(), m_compressor, and m_mysql.

Referenced by instance().

Here is the call graph for this function:


Member Function Documentation

void SctArchiving::IOManagerDB::addRun unsigned long  runNumber  )  [virtual]
 

Add a run - gets location identifier from getLocationIdentifier.

Definition at line 213 of file IOManagerDB.cpp.

References checkForErrors(), getLocationName(), and m_mysql.

Here is the call graph for this function:

void SctArchiving::IOManagerDB::addScan const TestData testdata,
unsigned  scanNumber
[virtual]
 

Add a scan.

Identifies correct Test from start time of TestData.

Definition at line 282 of file IOManagerDB.cpp.

References checkForErrors(), convertToMysqlDateTimeFormat(), getLocationName(), m_mysql, TestData::runNumber, TestData::startTime, and TestData::testName.

Referenced by addTest().

Here is the call graph for this function:

void SctArchiving::IOManagerDB::addTest const TestData testdata,
bool  alsoAddScans
[virtual]
 

Add a test.

Parameters:
alsoAddScans if this is true, it will loop over the scans in the test adding them too

Definition at line 244 of file IOManagerDB.cpp.

References addScan(), checkForErrors(), convertToMysqlDateTimeFormat(), TestData::endTime, getLocationName(), m_mysql, TestData::nScans, TestData::runNumber, TestData::startScanNumber, TestData::startTime, and TestData::testName.

Here is the call graph for this function:

void SctArchiving::IOManagerDB::checkForErrors const string &  msg,
const string &  query,
const string &  file,
int  line
[private]
 

throw MysqlException if there is an error in the mysql object - listing query

Definition at line 47 of file IOManagerDB.cpp.

References m_mysql.

void SctArchiving::IOManagerDB::checkForErrors const string &  msg,
const string &  file,
int  line
[private]
 

throw MysqlException if there is an error in the mysql object

Definition at line 37 of file IOManagerDB.cpp.

References m_mysql.

Referenced by addRun(), addScan(), addTest(), IOManagerDB(), runExists(), and testExists().

std::string SctArchiving::IOManagerDB::convertToMysqlDateTimeFormat const std::string &  isotime  )  [static]
 

conversion just removes 'T' from isotime

Definition at line 233 of file IOManagerDB.cpp.

Referenced by addScan(), addTest(), and testExists().

const SctData::ResultHeader & SctArchiving::IOManagerDB::getHeader const Sct::Serializable ob  )  [static, private]
 

get the header from a TestResult or ScanResult

Definition at line 115 of file IOManagerDB.cpp.

References Sct::Streamable::getClassName(), and Sct::Serializable::getUniqueID().

Here is the call graph for this function:

std::string SctArchiving::IOManagerDB::getLocationName  )  [virtual]
 

get string identifying data set e.g.

Barrel3_Cold_Oxford

Definition at line 312 of file IOManagerDB.cpp.

Referenced by addRun(), addScan(), addTest(), runExists(), and testExists().

string SctArchiving::IOManagerDB::getTable const Sct::Serializable ob  )  [static, private]
 

find the name of the table which the ob should to into.

Definition at line 134 of file IOManagerDB.cpp.

IOManagerDB & SctArchiving::IOManagerDB::instance  )  [static]
 

retrieve access to singleton

Definition at line 98 of file IOManagerDB.cpp.

References IOManagerDB(), and s_man.

Here is the call graph for this function:

boost::shared_ptr< Serializable > SctArchiving::IOManagerDB::read const string &  name,
const Sct::IOParams params = 0
const [virtual]
 

read using appropriate streamers

Definition at line 151 of file IOManagerDB.cpp.

References Sct::Archive::IOManagerStreamerVersioned::getMutex(), Sct::Archive::IOManagerStreamerVersioned::getReadVersionMap(), m_compressor, Sct::Archive::IOManagerStreamerVersioned::readImpl(), and Sct::Archive::IOManagerStreamerVersioned::setReadMode().

Here is the call graph for this function:

bool SctArchiving::IOManagerDB::runExists unsigned long  runNumber  )  [virtual]
 

Returns true if run already exists.

Definition at line 194 of file IOManagerDB.cpp.

References checkForErrors(), getLocationName(), and m_mysql.

Here is the call graph for this function:

bool SctArchiving::IOManagerDB::scanExists const TestData testdata,
unsigned  scanNumber
[virtual]
 

check if scan exists

Definition at line 277 of file IOManagerDB.cpp.

std::string SctArchiving::IOManagerDB::status  )  const [virtual]
 

get some status information

Implements Sct::Archive::IOManagerArchive.

Definition at line 103 of file IOManagerDB.cpp.

References m_compressor.

bool SctArchiving::IOManagerDB::testExists const TestData testdata  )  [virtual]
 

check if scan exists

Definition at line 169 of file IOManagerDB.cpp.

References checkForErrors(), convertToMysqlDateTimeFormat(), getLocationName(), m_mysql, TestData::runNumber, TestData::startTime, and TestData::testName.

Here is the call graph for this function:

void SctArchiving::IOManagerDB::write const Sct::Serializable ob,
const Sct::IOParams params = 0
const [virtual]
 

write using default streamers

Definition at line 138 of file IOManagerDB.cpp.

References Sct::Archive::IOManagerStreamerVersioned::getMutex(), and Sct::Archive::IOManagerStreamerVersioned::setReadMode().

Here is the call graph for this function:


Field Documentation

boost::shared_ptr<ZlibStringCompressor> SctArchiving::IOManagerDB::m_compressor [private]
 

keep a string compressor handy to zip and unzip BLOB data.

Definition at line 103 of file IOManagerDB.h.

Referenced by IOManagerDB(), read(), and status().

MYSQL* SctArchiving::IOManagerDB::m_mysql [private]
 

the main MYSQL object

Definition at line 106 of file IOManagerDB.h.

Referenced by addRun(), addScan(), addTest(), checkForErrors(), IOManagerDB(), runExists(), and testExists().

IOManagerDB * SctArchiving::IOManagerDB::s_man [static, private]
 

pointer to singleton

Definition at line 96 of file IOManagerDB.cpp.

Referenced by instance().


The documentation for this class was generated from the following files:
Generated on Fri Sep 16 18:03:30 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5