owlps/owlps-positioning/src/posexcept.cc

86 lines
1.7 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.
*/
#include "posexcept.hh"
#include <sstream>
using namespace std ;
/* *** Miscellaneous exceptions *** */
cannot_merge::
cannot_merge(const string &_explanation) throw():
posexcept(_explanation) {}
element_not_found::
element_not_found(const string &_explanation) throw():
posexcept("Element not found in collection: " + _explanation) {}
/* *** Configuration *** */
missing_configuration::
missing_configuration(const string &_explanation) throw():
posexcept(_explanation) {}
bad_configuration::
bad_configuration(const string &_explanation) throw():
posexcept(_explanation) {}
/* *** Input *** */
malformed_input_data::
malformed_input_data(const string &_explanation) throw():
posexcept("Read error: " + _explanation) {}
bad_direction::bad_direction(const char direction) throw()
{
ostringstream message ;
message << "`" << static_cast<int>(direction)
<< "` is not a valid direction value!" ;
explanation = message.str() ;
}
bad_channel::bad_channel(const unsigned long channel) throw()
{
ostringstream message ;
message << "`" << channel
<< "` is not a valid channel value!" ;
explanation = message.str() ;
}
null_input_medium::null_input_medium() throw():
posexcept("The input medium is not initialised!") {}
/* *** Files *** */
error_opening_input_file::
error_opening_input_file(const string &file_name) throw():
posexcept("Error opening input file \"" + file_name + "\"!") {}
error_opening_output_file::
error_opening_output_file(const string &file_name) throw():
posexcept("Error opening output file \"" + file_name + "\"!") {}