SOPT
Sparse OPTimisation
Public Member Functions | Static Public Member Functions | List of all members
sopt::Exception Class Reference

Root exception for sopt. More...

#include <exception.h>

+ Inheritance diagram for sopt::Exception:
+ Collaboration diagram for sopt::Exception:

Public Member Functions

 Exception (std::string const &filename, size_t lineno)
 Creates exception. More...
 
const char * what () const noexcept override
 Creates message. More...
 
template<typename OBJECT >
Exceptionoperator<< (OBJECT const &object)
 Adds to message. More...
 

Static Public Member Functions

static std::string header (std::string const &name, std::string const &filename, size_t lineno)
 Header of the message. More...
 

Detailed Description

Root exception for sopt.

Definition at line 11 of file exception.h.

Constructor & Destructor Documentation

◆ Exception()

sopt::Exception::Exception ( std::string const &  filename,
size_t  lineno 
)
inline

Creates exception.

Definition at line 19 of file exception.h.

20  : Exception("sopt::Exception", filename, lineno) {}

Member Function Documentation

◆ header()

static std::string sopt::Exception::header ( std::string const &  name,
std::string const &  filename,
size_t  lineno 
)
inlinestatic

Header of the message.

Definition at line 26 of file exception.h.

26  {
27  std::ostringstream header;
28  header << name << " at " << filename << ":" << lineno;
29  return header.str();
30  }
static std::string header(std::string const &name, std::string const &filename, size_t lineno)
Header of the message.
Definition: exception.h:26

◆ operator<<()

template<typename OBJECT >
Exception& sopt::Exception::operator<< ( OBJECT const &  object)
inline

Adds to message.

Definition at line 34 of file exception.h.

34  {
35  std::ostringstream msg;
36  msg << message << object;
37  message = msg.str();
38  return *this;
39  }

◆ what()

const char* sopt::Exception::what ( ) const
inlineoverridenoexcept

Creates message.

Definition at line 23 of file exception.h.

23 { return message.c_str(); }

The documentation for this class was generated from the following file: