sync with GH
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15634 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
46
src/error.h
46
src/error.h
@ -15,41 +15,14 @@
|
||||
#define LMP_ERROR_H
|
||||
|
||||
#include "pointers.h"
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#ifdef LAMMPS_EXCEPTIONS
|
||||
#include "exceptions.h"
|
||||
#endif
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class LAMMPSException : public std::exception
|
||||
{
|
||||
public:
|
||||
std::string message;
|
||||
|
||||
LAMMPSException(std::string msg) : message(msg) {
|
||||
}
|
||||
|
||||
~LAMMPSException() throw() {
|
||||
}
|
||||
|
||||
virtual const char * what() const throw() {
|
||||
return message.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
class LAMMPSAbortException : public LAMMPSException {
|
||||
public:
|
||||
MPI_Comm universe;
|
||||
|
||||
LAMMPSAbortException(std::string msg, MPI_Comm universe) :
|
||||
LAMMPSException(msg),
|
||||
universe(universe)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class Error : protected Pointers {
|
||||
char * last_error_message;
|
||||
|
||||
public:
|
||||
Error(class LAMMPS *);
|
||||
|
||||
@ -63,8 +36,15 @@ class Error : protected Pointers {
|
||||
void message(const char *, int, const char *, int = 1);
|
||||
void done(int = 0); // 1 would be fully backwards compatible
|
||||
|
||||
char * get_last_error() const;
|
||||
void set_last_error(const char * msg);
|
||||
#ifdef LAMMPS_EXCEPTIONS
|
||||
char * get_last_error() const;
|
||||
ErrorType get_last_error_type() const;
|
||||
void set_last_error(const char * msg, ErrorType type = ERROR_NORMAL);
|
||||
|
||||
private:
|
||||
char * last_error_message;
|
||||
ErrorType last_error_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user