PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
exceptions.hpp
Go to the documentation of this file.
1 
13 #ifndef PLSSVM_EXCEPTIONS_EXCEPTIONS_HPP_
14 #define PLSSVM_EXCEPTIONS_EXCEPTIONS_HPP_
15 #pragma once
16 
17 #include "plssvm/exceptions/source_location.hpp" // plssvm::source_location
18 
19 #include <stdexcept> // std::runtime_error
20 #include <string> // std::string
21 #include <string_view> // std::string_view
22 
23 namespace plssvm {
24 
29 class exception : public std::runtime_error {
30  public:
37  explicit exception(const std::string &msg, std::string_view class_name = "exception", source_location loc = source_location::current());
38 
43  [[nodiscard]] const source_location &loc() const noexcept;
44 
50  [[nodiscard]] std::string what_with_loc() const;
51 
52  private:
54  std::string_view class_name_;
57 };
58 
63  public:
70 };
71 
76  public:
82  explicit file_reader_exception(const std::string &msg, source_location loc = source_location::current());
83 };
84 
88 class data_set_exception : public exception {
89  public:
95  explicit data_set_exception(const std::string &msg, source_location loc = source_location::current());
96 };
97 
102  public:
109 };
110 
115  public:
122 };
123 
128  public:
135 };
136 
141  public:
148 };
149 
154  public:
161 };
162 
163 } // namespace plssvm
164 
165 #endif // PLSSVM_EXCEPTIONS_EXCEPTIONS_HPP_
Exception type thrown if a data_set is used inappropriately.
Definition: exceptions.hpp:88
data_set_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Base class for all custom exception types. Forwards its message to std::runtime_error and saves the e...
Definition: exceptions.hpp:29
source_location loc_
The call side source location information.
Definition: exceptions.hpp:56
exception(const std::string &msg, std::string_view class_name="exception", source_location loc=source_location::current())
Construct a new exception forwarding the exception message to std::runtime_error.
std::string_view class_name_
The name of the thrown exception class.
Definition: exceptions.hpp:54
const source_location & loc() const noexcept
Returns the information of the call side where the exception was thrown.
std::string what_with_loc() const
Returns a string containing the exception's what() message, the name of the thrown exception class,...
Exception type thrown if the provided file couldn't be found.
Definition: exceptions.hpp:101
file_not_found_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Exception type thrown if the file_reader is used inappropriately (e.g., if two files should be opened...
Definition: exceptions.hpp:75
file_reader_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Exception type thrown if an error in the generic plssvm::detail::gpu_device_ptr occurred.
Definition: exceptions.hpp:153
gpu_device_ptr_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Exception type thrown if the provided file has an invalid format for the selected parser (e....
Definition: exceptions.hpp:114
invalid_file_format_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Exception type thrown if the provided parameter is invalid.
Definition: exceptions.hpp:62
invalid_parameter_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
The plssvm::source_location class represents certain information about the source code,...
Definition: source_location.hpp:25
static constexpr source_location current(const char *file_name=__builtin_FILE(), const char *function_name=__builtin_FUNCTION(), int line=__builtin_LINE(), int column=0) noexcept
Construct new source location information about the current call side.
Definition: source_location.hpp:35
Exception type thrown if the requested backend is not supported on the target machine.
Definition: exceptions.hpp:127
unsupported_backend_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
Exception type thrown if the requested kernel type is not supported.
Definition: exceptions.hpp:140
unsupported_kernel_type_exception(const std::string &msg, source_location loc=source_location::current())
Construct a new exception forwarding the exception message and source location to plssvm::exception.
The main namespace containing all public API functions.
Definition: backend_types.hpp:24
Implements a custom std::source_location implementation for C++17.