MIRA
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ErrorService Class Reference

Class that allows to store errors persistently in a SQLite database. More...

#include <fw/ErrorService.h>

Classes

struct  Error
 Error informations. More...
 

Public Types

typedef std::vector< ErrorErrorVector
 A vector of errors. More...
 

Public Member Functions

 ErrorService (Authority &authority, const std::string &errorDBFilename)
 
template<typename Reflector >
void reflect (Reflector &r)
 Reflect method for serialization. More...
 
void setError (const std::string &category, const std::string &authority, const std::string &errorTxt, const std::string &message)
 Stores an error in a category for the given authority in the database. More...
 
void resetError (const std::string &category, const std::string &authority)
 Reset errors in a category for the given authority. More...
 
void resetErrors (const std::string &authority)
 Reset all errors for the given authority. More...
 
uint32 getErrorCount (const std::string &authority)
 Get number of errors for the given authority. More...
 
ErrorVector getErrors ()
 Get all errors from the database. More...
 
std::string getErrorText (const std::string &error, const std::string &language)
 Get a translation of an error text for the specified language. More...
 

Protected Member Functions

void checkDB ()
 

Protected Attributes

boost::mutex mMutex
 
AuthoritymAuthority
 
std::string mErrorDBFilename
 
boost::shared_ptr< SQLiteDBmDB
 

Detailed Description

Class that allows to store errors persistently in a SQLite database.

Member Typedef Documentation

◆ ErrorVector

typedef std::vector<Error> ErrorVector

A vector of errors.

Constructor & Destructor Documentation

◆ ErrorService()

ErrorService ( Authority authority,
const std::string &  errorDBFilename 
)

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

Reflect method for serialization.

◆ setError()

void setError ( const std::string &  category,
const std::string &  authority,
const std::string &  errorTxt,
const std::string &  message 
)

Stores an error in a category for the given authority in the database.

If the same error exists in the database

Parameters
[in]categoryError category
[in]authorityThe authority that reports the error
[in]errorTxtThe error text that is used for translation of errors
[in]messageThe error message that will not be translated

◆ resetError()

void resetError ( const std::string &  category,
const std::string &  authority 
)

Reset errors in a category for the given authority.

Parameters
[in]categoryThe category to clear the errors
[in]authorityThe authority that reported the error

◆ resetErrors()

void resetErrors ( const std::string &  authority)

Reset all errors for the given authority.

Parameters
[in]authorityThe authority that reported the errors

◆ getErrorCount()

uint32 getErrorCount ( const std::string &  authority)

Get number of errors for the given authority.

Parameters
[in]authorityThe authority that reported the errors

◆ getErrors()

ErrorVector getErrors ( )

Get all errors from the database.

◆ getErrorText()

std::string getErrorText ( const std::string &  error,
const std::string &  language 
)

Get a translation of an error text for the specified language.

◆ checkDB()

void checkDB ( )
protected

Member Data Documentation

◆ mMutex

boost::mutex mMutex
protected

◆ mAuthority

Authority& mAuthority
protected

◆ mErrorDBFilename

std::string mErrorDBFilename
protected

◆ mDB

boost::shared_ptr<SQLiteDB> mDB
protected

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