owlps/owlps-positioning/src/posexcept.hh

123 lines
2.0 KiB
C++

/*
* This file is part of the Owl Positioning System (OwlPS).
* OwlPS is a project of the University of Franche-Comté
* (Université de Franche-Comté), France.
*/
#ifndef _OWLPS_POSITIONING_POSEXCEPT_HH_
#define _OWLPS_POSITIONING_POSEXCEPT_HH_
#include <exception>
#include <string>
/// Super-class of all exceptions defined in OWLPS-Positioning
class posexcept: public std::exception
{
protected:
std::string explanation ;
public:
posexcept(const std::string &_explanation = "") throw():
explanation(_explanation) {}
~posexcept(void) throw() {}
const char* what(void) const throw()
{
return explanation.c_str() ;
}
} ;
/* *** Miscellaneous exceptions *** */
class cannot_merge: public posexcept
{
public:
cannot_merge(const std::string &_explanation) throw() ;
} ;
class element_not_found: public posexcept
{
public:
element_not_found(const std::string &_explanation) throw() ;
} ;
/* *** Configuration *** */
class missing_configuration: public posexcept
{
public:
missing_configuration(const std::string &_explanation) throw() ;
} ;
class bad_configuration: public posexcept
{
public:
bad_configuration(const std::string &_explanation) throw() ;
} ;
/* *** Input *** */
class malformed_input_data: public posexcept
{
public:
malformed_input_data(const std::string &_explanation) throw() ;
} ;
class bad_direction: public posexcept
{
public:
bad_direction(const char direction) throw() ;
} ;
class bad_channel: public posexcept
{
public:
bad_channel(const unsigned long channel) throw() ;
} ;
class null_input_medium: public posexcept
{
public:
null_input_medium(void) throw() ;
} ;
/* *** Files *** */
class error_opening_input_file: public posexcept
{
public:
error_opening_input_file(const std::string &file_name) throw() ;
} ;
class error_opening_output_file: public posexcept
{
public:
error_opening_output_file(const std::string &file_name) throw() ;
} ;
#endif // _OWLPS_POSITIONING_POSEXCEPT_HH_