Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
SerializationException.h
Go to the documentation of this file.
1 //===-- serialbox/core/frontend/stella/SerializationException.h ---------------------*- C++ -*-===//
2 //
3 // S E R I A L B O X
4 //
5 // This file is distributed under terms of BSD license.
6 // See LICENSE.txt for more information
7 //
8 //===------------------------------------------------------------------------------------------===//
9 //
13 //===------------------------------------------------------------------------------------------===//
14 
15 #ifndef SERIALBOX_CORE_FRONTEND_STELLA_SERIALIZATIONEXCEPTION_H
16 #define SERIALBOX_CORE_FRONTEND_STELLA_SERIALIZATIONEXCEPTION_H
17 
19 #include <exception>
20 #include <string>
21 
22 namespace serialbox {
23 
24 namespace stella {
25 
30 public:
33 
35  virtual ~SerializationException() throw() {}
36 
38  void Init(const std::string& errormsg) { message_ = errormsg; }
39 
41  const char* what() const throw() { return message_.c_str(); }
42 
44  const std::string& message() const { return message_; }
45 
46 private:
47  std::string message_;
48 };
49 
50 } // namespace stella
51 
52 } // namespace serialbox
53 
54 #endif
const char * what() const
Returns an explanatory string.
const std::string & message() const
Returns an explanatory string.
Namespace of the STELLA frontend.
Definition: ForwardDecl.h:27
Namespace of the serialbox library.
Definition: Archive.h:25
Exception of the STELLA frontend.
serialbox::Exception exception
Exception class which stores a human-readable error description.
Definition: Exception.h:33
virtual ~SerializationException()
Virtual destructor.
void Init(const std::string &errormsg)
Initialize the exception with an explanatory string errormsg