owlps/owlps-positioning/src/posexcept.cc

159 lines
3.1 KiB
C++
Raw Normal View History

#include "posexcept.hh"
#include <sstream>
using namespace std ;
/* *** Other exceptions *** */
bad_direction::bad_direction(const char _direction) throw()
{
direction = _direction ;
}
const char* bad_direction::what() const throw()
{
ostringstream message ;
message << "`" << static_cast<int>(direction)
<< "` is not a valid direction value!" ;
return message.str().c_str() ;
}
element_not_found::
element_not_found(const string &_explanation) throw():
explanation(_explanation) {}
const char* element_not_found::what() const throw()
{
string message = "Element not found in collection: " + explanation ;
return message.c_str() ;
}
/* *** Input *** */
/**
* @param _medium_name The medium that is unknown
*/
input_medium_type_unknown::
input_medium_type_unknown(const string &_medium_name) throw():
medium_name(_medium_name) {}
const char* input_medium_type_unknown::what() const throw()
{
string message = "The specified input medium « "+ medium_name +
" » is unknown!" ;
return message.c_str() ;
}
const char* no_input_medium::what() const throw()
{
return "No input medium specified in configuration!" ;
}
const char* null_input_medium::what() const throw()
{
return "The input medium is not initialised!" ;
}
const char* no_input_csv_file::what() const throw()
{
return "No input CSV file specified in the configuration!" ;
}
const char* no_log_csv_file::what() const throw()
{
return "No log CSV file specified in the configuration!" ;
}
error_opening_input_file::
error_opening_input_file(const string &_file_name) throw():
file_name(_file_name) {}
const char* error_opening_input_file::what() const throw()
{
string message = "Error opening input file « " +
file_name + " »!" ;
return message.c_str() ;
}
/* *** Output *** */
/**
* @param _medium_name The medium that is unknown
*/
output_medium_type_unknown::
output_medium_type_unknown(const string &_medium_name) throw():
medium_name(_medium_name) {}
const char* output_medium_type_unknown::what() const throw()
{
string message = "The specified output medium « "+ medium_name +
" » is unknown!" ;
return message.c_str() ;
}
const char* no_output_csv_file::what() const throw()
{
return "No input CSV file specified in the configuration!" ;
}
error_opening_output_file::
error_opening_output_file(const string &_file_name) throw():
file_name(_file_name) {}
const char* error_opening_output_file::what() const throw()
{
string message = "Error opening output file « " +
file_name + " »!" ;
return message.c_str() ;
}
/* *** Algorithms *** */
const char* no_positioning_algorithm::what() const throw()
{
return "No positioning algorithm specified in configuration!" ;
}
/**
* @param _algo_name The algo that is unknown
*/
positioning_algorithm_unknown::
positioning_algorithm_unknown(const string &_algo_name) throw():
algo_name(_algo_name) {}
const char* positioning_algorithm_unknown::what() const throw()
{
string message = "The specified positioning_algorithm « "+ algo_name +
" » is unknown!" ;
return message.c_str() ;
}