owlps/owlps-positioner/posexcept.hh

144 lines
2.7 KiB
C++

/*
* This file is part of the Owl Positioning System (OwlPS) project.
* It is subject to the copyright notice and license terms in the
* COPYRIGHT.t2t file found in the top-level directory of this
* distribution and at
* https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
* No part of the OwlPS Project, including this file, may be copied,
* modified, propagated, or distributed except according to the terms
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
* distributed along with this file, either separately or by replacing
* this notice by the COPYRIGHT.t2t file's contents.
*/
#ifndef _OWLPS_POSITIONING_POSEXCEPT_HH_
#define _OWLPS_POSITIONING_POSEXCEPT_HH_
#include <exception>
#include <string>
/// Super-class of all exceptions defined in OwlPS Positioner
class posexcept: public std::exception
{
protected:
std::string explanation ;
public:
explicit 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:
explicit cannot_merge(const std::string &_explanation) throw();
} ;
class element_already_exists: public posexcept
{
public:
explicit element_already_exists(const std::string &_explanation) throw();
} ;
class element_not_found: public posexcept
{
public:
explicit element_not_found(const std::string &_explanation) throw();
} ;
class autocalibration_error: public posexcept
{
public:
explicit autocalibration_error(const std::string &_explanation) throw();
} ;
/* *** Configuration *** */
class missing_configuration: public posexcept
{
public:
explicit missing_configuration(const std::string &_explanation) throw();
} ;
class bad_configuration: public posexcept
{
public:
explicit bad_configuration(const std::string &_explanation) throw();
} ;
/* *** Input *** */
class malformed_input_data: public posexcept
{
public:
explicit malformed_input_data(const std::string &_explanation) throw();
} ;
class bad_direction: public posexcept
{
public:
explicit bad_direction(const char direction) throw();
} ;
class bad_channel: public posexcept
{
public:
explicit 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:
explicit error_opening_input_file(const std::string &file_name) throw();
} ;
class error_opening_output_file: public posexcept
{
public:
explicit error_opening_output_file(const std::string &file_name) throw();
} ;
#endif // _OWLPS_POSITIONING_POSEXCEPT_HH_