#ifndef DBIEXCEPTIONLOG
#define DBIEXCEPTIONLOG
//////////////////////////////////////////////////////////////////////////
//////////////////////////// ROOT API ////////////////////////////
//////////////////////////////////////////////////////////////////////////
/**
*
* $Id: IDbiExceptionLog.hxx,v 1.1 2011/01/18 05:49:19 finch Exp $
*
* \class COMET::IDbiExceptionLog
*
*
* \brief
* Concept An object that records database exceptions
*
* \brief
* PurposeTo provide a place to record (in memory) exceptions from the time
* they arise in the lower levels of the DBI and below until they can be
* analysed in the upper levels of the DBI and beyond. They are stored in a std::vector
* of COMET::IDbiException s
*
* Contact: A.Finch@lancaster.ac.uk
*
*
*/
#include
#include
#include
#include "Rtypes.h"
#include "IDbiException.hxx"
class TSQLServer;
class TSQLStatement;
namespace COMET {
class IDbiExceptionLog;
}
std::ostream& operator<<(std::ostream& s, const COMET::IDbiExceptionLog& el);
namespace COMET {
class IDbiExceptionLog
{
public:
IDbiExceptionLog(const IDbiException* e = 0);
virtual ~IDbiExceptionLog();
// State testing member functions
Bool_t IsEmpty() const { return fEntries.size() == 0; }
const std::vector&
GetEntries() const { return fEntries; }
void Print() const;
UInt_t Size() const { return fEntries.size(); }
void Copy(IDbiExceptionLog& that, UInt_t start=0) const;
// State changing member functions
void AddLog(const IDbiExceptionLog& el);
void AddEntry(const IDbiException& e) { fEntries.push_back(e); }
void AddEntry(const char* errMsg, Int_t code = -1) {
this->AddEntry(IDbiException(errMsg,code));}
void AddEntry(const std::string& errMsg, Int_t code = -1) {
this->AddEntry(IDbiException(errMsg.c_str(),code));}
void AddEntry(const TSQLServer& server) {
this->AddEntry(IDbiException(server));}
void AddEntry(const TSQLStatement& statement) {
this->AddEntry(IDbiException(statement));}
void Clear() { fEntries.clear(); }
// The Global Exception Log
static IDbiExceptionLog& GetGELog() { return fgGELog;}
private:
// Data members
private:
/// The exception entries.
std::vector fEntries;
/// Global Exception Log
static IDbiExceptionLog fgGELog;
ClassDef(IDbiExceptionLog,0) // Object to hold database exceptions
};
};
#endif // DBIEXCEPTIONLOG