Loading...
Searching...
No Matches
COMMON/exception.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_COMMON_EXCEPTION_H
#define BALL_COMMON_EXCEPTION_H
#ifndef BALL_CONFIG_CONFIG_H
# include <BALL/CONFIG/config.h>
#endif
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
#ifdef BALL_COMPILER_MSVC
#pragma warning(push)
#pragma warning( disable : 4251 ) //disable needs to have dll-interface to be used by clients of class 'std::string'
#endif
#include <new>
#include <string>
namespace BALL
{
class String;
namespace Exception
{
class BALL_EXPORT GeneralException
: public std::exception
{
public:
GeneralException();
GeneralException(const char* file, int line);
GeneralException
(const char* file, int line,
const String& name , const String& message);
GeneralException(const GeneralException& exception);
virtual ~GeneralException() throw();
const char* getName() const;
const char* getMessage() const;
void setMessage(const std::string& message);
int getLine() const;
const char* getFile() const;
protected:
const char* file_;
int line_;
std::string name_;
std::string message_;
};
class BALL_EXPORT IndexUnderflow
: public GeneralException
{
public:
IndexUnderflow(const char* file, int line, Index index = 0, Size size = 0);
protected:
Size size_;
Index index_;
};
class BALL_EXPORT SizeUnderflow
: public GeneralException
{
public:
SizeUnderflow(const char* file, int line, Size size = 0);
protected:
Size size_;
};
class BALL_EXPORT IndexOverflow
: public GeneralException
{
public:
IndexOverflow(const char* file, int line, Index index = 0, Size size = 0);
protected:
Size size_;
Index index_;
};
class BALL_EXPORT InvalidArgument
: public GeneralException
{
public:
InvalidArgument(const char* file, int line, const String& arg);
};
class BALL_EXPORT InvalidRange
: public GeneralException
{
public:
InvalidRange(const char* file, int line, float value);
};
class BALL_EXPORT InvalidSize
: public GeneralException
{
public:
InvalidSize(const char* file, int line, Size size = 0);
protected:
Size size_;
};
class BALL_EXPORT OutOfRange
: public GeneralException
{
public:
OutOfRange(const char* file, int line);
};
class BALL_EXPORT InvalidFormat
: public GeneralException
{
public:
InvalidFormat(const char* file, int line, const String& s);
~InvalidFormat() throw();
protected:
std::string format_;
};
class BALL_EXPORT IllegalSelfOperation
: public GeneralException
{
public:
IllegalSelfOperation(const char* file, int line);
};
class BALL_EXPORT NullPointer
: public GeneralException
{
public:
NullPointer(const char* file, int line);
};
class BALL_EXPORT InvalidIterator
: public GeneralException
{
public:
InvalidIterator(const char* file, int line);
};
class BALL_EXPORT IncompatibleIterators
: public GeneralException
{
public:
IncompatibleIterators(const char* file, int line);
};
class BALL_EXPORT NotImplemented
: public GeneralException
{
public:
NotImplemented(const char* file, int line);
};
class BALL_EXPORT IllegalTreeOperation
: public GeneralException
{
public:
IllegalTreeOperation(const char* file, int line);
};
class BALL_EXPORT OutOfMemory
: public GeneralException, public std::bad_alloc
{
public:
OutOfMemory(const char* file, int line, Size size = 0);
virtual ~OutOfMemory()
throw();
protected:
Size size_;
};
class BALL_EXPORT BufferOverflow
: public GeneralException
{
public:
BufferOverflow(const char* file, int line);
};
class BALL_EXPORT DivisionByZero
: public GeneralException
{
public:
DivisionByZero(const char* file, int line);
};
class BALL_EXPORT OutOfGrid
: public GeneralException
{
public:
OutOfGrid(const char* file, int line);
};
class BALL_EXPORT FileNotFound
: public GeneralException
{
public:
FileNotFound(const char* file, int line, const String& filename);
~FileNotFound()
throw();
String getFilename() const;
protected:
std::string filename_;
};
class BALL_EXPORT IllegalPosition
: public GeneralException
{
public:
IllegalPosition(const char* file, int line, float x, float y, float z);
};
class BALL_EXPORT ParseError
: public GeneralException
{
public:
ParseError(const char* file, int line, const String& expression,
const String& message);
};
class BALL_EXPORT Precondition
: public GeneralException
{
public:
Precondition(const char* file, int line, const char* condition);
};
class BALL_EXPORT Postcondition
: public GeneralException
{
public:
Postcondition(const char* file, int line, const char* condition);
};
class BALL_EXPORT InvalidOption: public Exception::GeneralException
{
public:
InvalidOption(const char* file, int line, String option);
};
class BALL_EXPORT TooManyErrors
: public Exception::GeneralException
{
public:
TooManyErrors(const char* file, int line);
};
class BALL_EXPORT TooManyBonds
: public Exception::GeneralException
{
public:
TooManyBonds(const char* file, int line, const String& error);
};
class BALL_DEPRECATED BALL_EXPORT CUDAError
: public Exception::GeneralException
{
public:
CUDAError(const char* file, int line, const String& error);
};
class BALL_EXPORT NoBufferAvailable
: public Exception::GeneralException
{
public:
NoBufferAvailable(const char* file, int line, const String& reason);
};
class BALL_EXPORT FormatUnsupported
: public Exception::GeneralException
{
public:
FormatUnsupported(const char* file, int line);
};
class BALL_EXPORT NotInitialized : public Exception::GeneralException
{
public:
NotInitialized(const char* file, int line, const String& reason);
};
class BALL_EXPORT GlobalExceptionHandler
{
public:
GlobalExceptionHandler();
static void setName(const String& name);
static void setMessage(const String& message);
static void setLine(int line);
static void setFile(const String& file);
static void set
(const String& file, int line,
const String& name, const String& message);
protected:
static void terminate();
static void newHandler();
static std::string file_;
static int line_;
static std::string name_;
static std::string message_;
};
BALL_EXPORT extern GlobalExceptionHandler globalHandler;
}
BALL_EXPORT
std::ostream& operator << (std::ostream& os, const Exception::GeneralException& e);
} // namespace BALL
#ifdef BALL_COMPILER_MSVC
#pragma warning(pop)
#endif
#endif // BALL_COMMON_EXCEPTION_H
global.h
BALL_DEPRECATED
#define BALL_DEPRECATED
Definition COMMON/global.h:64
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Exception::BufferOverflow::BufferOverflow
BufferOverflow(const char *file, int line)
BALL::Exception::CUDAError::CUDAError
CUDAError(const char *file, int line, const String &error)
BALL::Exception::DivisionByZero::DivisionByZero
DivisionByZero(const char *file, int line)
BALL::Exception::FileNotFound::filename_
std::string filename_
Definition COMMON/exception.h:370
BALL::Exception::FileNotFound::~FileNotFound
~FileNotFound()
BALL::Exception::FileNotFound::getFilename
String getFilename() const
BALL::Exception::FileNotFound::FileNotFound
FileNotFound(const char *file, int line, const String &filename)
BALL::Exception::FormatUnsupported::FormatUnsupported
FormatUnsupported(const char *file, int line)
BALL::Exception::GeneralException
Definition COMMON/exception.h:61
BALL::Exception::GeneralException::getFile
const char * getFile() const
Returns the file where it occurred.
BALL::Exception::GeneralException::setMessage
void setMessage(const std::string &message)
Modify the exception's error message.
BALL::Exception::GeneralException::getLine
int getLine() const
Returns the line number where it occurred.
BALL::Exception::GeneralException::~GeneralException
virtual ~GeneralException()
Destructor.
BALL::Exception::GeneralException::getMessage
const char * getMessage() const
Returns the error message of the exception.
BALL::Exception::GeneralException::GeneralException
GeneralException()
Default constructor.
BALL::Exception::GeneralException::message_
std::string message_
Definition COMMON/exception.h:111
BALL::Exception::GeneralException::GeneralException
GeneralException(const char *file, int line, const String &name, const String &message)
Constructor.
BALL::Exception::GeneralException::name_
std::string name_
Definition COMMON/exception.h:110
BALL::Exception::GeneralException::getName
const char * getName() const
Returns the name of the exception.
BALL::Exception::GeneralException::file_
const char * file_
Definition COMMON/exception.h:107
BALL::Exception::GeneralException::line_
int line_
Definition COMMON/exception.h:108
BALL::Exception::GeneralException::GeneralException
GeneralException(const char *file, int line)
Constructor.
BALL::Exception::GeneralException::GeneralException
GeneralException(const GeneralException &exception)
Copy constructor.
BALL::Exception::GlobalExceptionHandler
Definition COMMON/exception.h:494
BALL::Exception::GlobalExceptionHandler::set
static void set(const String &file, int line, const String &name, const String &message)
Set all exception attributes.
BALL::Exception::GlobalExceptionHandler::GlobalExceptionHandler
GlobalExceptionHandler()
BALL::Exception::GlobalExceptionHandler::file_
static std::string file_
Definition COMMON/exception.h:551
BALL::Exception::GlobalExceptionHandler::setFile
static void setFile(const String &file)
The source file name where the exception was thrown.
BALL::Exception::GlobalExceptionHandler::setName
static void setName(const String &name)
Assign the name of the exception. This should agree with the class name.
BALL::Exception::GlobalExceptionHandler::setLine
static void setLine(int line)
Set the line number the exception was thrown. Should be set to LINE in most cases.
BALL::Exception::GlobalExceptionHandler::terminate
static void terminate()
The BALL replacement for terminate.
BALL::Exception::GlobalExceptionHandler::setMessage
static void setMessage(const String &message)
Set the error message.
BALL::Exception::GlobalExceptionHandler::newHandler
static void newHandler()
BALL::Exception::GlobalExceptionHandler::name_
static std::string name_
Definition COMMON/exception.h:553
BALL::Exception::GlobalExceptionHandler::message_
static std::string message_
Definition COMMON/exception.h:554
BALL::Exception::GlobalExceptionHandler::line_
static int line_
Definition COMMON/exception.h:552
BALL::Exception::IllegalPosition::IllegalPosition
IllegalPosition(const char *file, int line, float x, float y, float z)
BALL::Exception::IllegalSelfOperation::IllegalSelfOperation
IllegalSelfOperation(const char *file, int line)
BALL::Exception::IllegalTreeOperation::IllegalTreeOperation
IllegalTreeOperation(const char *file, int line)
BALL::Exception::IncompatibleIterators::IncompatibleIterators
IncompatibleIterators(const char *file, int line)
BALL::Exception::IndexOverflow::IndexOverflow
IndexOverflow(const char *file, int line, Index index=0, Size size=0)
BALL::Exception::IndexOverflow::size_
Size size_
Definition COMMON/exception.h:170
BALL::Exception::IndexOverflow::index_
Index index_
Definition COMMON/exception.h:171
BALL::Exception::IndexUnderflow::size_
Size size_
Definition COMMON/exception.h:132
BALL::Exception::IndexUnderflow::index_
Index index_
Definition COMMON/exception.h:133
BALL::Exception::IndexUnderflow::IndexUnderflow
IndexUnderflow(const char *file, int line, Index index=0, Size size=0)
BALL::Exception::InvalidArgument::InvalidArgument
InvalidArgument(const char *file, int line, const String &arg)
BALL::Exception::InvalidFormat::~InvalidFormat
~InvalidFormat()
BALL::Exception::InvalidFormat::InvalidFormat
InvalidFormat(const char *file, int line, const String &s)
BALL::Exception::InvalidFormat::format_
std::string format_
Definition COMMON/exception.h:239
BALL::Exception::InvalidIterator::InvalidIterator
InvalidIterator(const char *file, int line)
BALL::Exception::InvalidOption::InvalidOption
InvalidOption(const char *file, int line, String option)
BALL::Exception::InvalidRange::InvalidRange
InvalidRange(const char *file, int line, float value)
BALL::Exception::InvalidSize::size_
Size size_
Definition COMMON/exception.h:209
BALL::Exception::InvalidSize::InvalidSize
InvalidSize(const char *file, int line, Size size=0)
BALL::Exception::NoBufferAvailable::NoBufferAvailable
NoBufferAvailable(const char *file, int line, const String &reason)
BALL::Exception::NotImplemented::NotImplemented
NotImplemented(const char *file, int line)
BALL::Exception::NotInitialized::NotInitialized
NotInitialized(const char *file, int line, const String &reason)
BALL::Exception::NullPointer::NullPointer
NullPointer(const char *file, int line)
BALL::Exception::OutOfGrid::OutOfGrid
OutOfGrid(const char *file, int line)
BALL::Exception::OutOfMemory::OutOfMemory
OutOfMemory(const char *file, int line, Size size=0)
BALL::Exception::OutOfMemory::~OutOfMemory
virtual ~OutOfMemory()
BALL::Exception::OutOfMemory::size_
Size size_
Definition COMMON/exception.h:326
BALL::Exception::OutOfRange::OutOfRange
OutOfRange(const char *file, int line)
BALL::Exception::ParseError::ParseError
ParseError(const char *file, int line, const String &expression, const String &message)
BALL::Exception::Postcondition::Postcondition
Postcondition(const char *file, int line, const char *condition)
BALL::Exception::Precondition::Precondition
Precondition(const char *file, int line, const char *condition)
BALL::Exception::SizeUnderflow::size_
Size size_
Definition COMMON/exception.h:151
BALL::Exception::SizeUnderflow::SizeUnderflow
SizeUnderflow(const char *file, int line, Size size=0)
BALL::Exception::TooManyBonds::TooManyBonds
TooManyBonds(const char *file, int line, const String &error)
BALL::Exception::TooManyErrors::TooManyErrors
TooManyErrors(const char *file, int line)
BALL::String
Definition string.h:57
BALL::Exception
Definition COMMON/exception.h:33
BALL::Exception::globalHandler
BALL_EXPORT GlobalExceptionHandler globalHandler
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
std
STL namespace.