MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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

typedef std::vector<Error> ErrorVector

A vector of errors.

Constructor & Destructor Documentation

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

Member Function Documentation

void reflect ( Reflector &  r)
inline

Reflect method for serialization.

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
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
void resetErrors ( const std::string &  authority)

Reset all errors for the given authority.

Parameters
[in]authorityThe authority that reported the errors
uint32 getErrorCount ( const std::string &  authority)

Get number of errors for the given authority.

Parameters
[in]authorityThe authority that reported the errors
ErrorVector getErrors ( )

Get all errors from the database.

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

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

void checkDB ( )
protected

Member Data Documentation

boost::mutex mMutex
protected
Authority& mAuthority
protected
std::string mErrorDBFilename
protected
boost::shared_ptr<SQLiteDB> mDB
protected

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