Exceptions.h

Go to the documentation of this file.
00001 //
00002 // Copyright (c) 2003-2005 greg Landrum and Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef _RD_EXCEPTIONS_H
00007 #define _RD_EXCEPTIONS_H
00008 #include <exception>
00009 #include <string>
00010 
00011 //! \brief Class to allow us to throw an \c IndexError from C++ and have
00012 //!         it make it back to Python
00013 //!
00014 class IndexErrorException : public std::exception
00015 {
00016 public:
00017   IndexErrorException(int i) : _idx(i) {};
00018   int index () const { return _idx; };
00019   ~IndexErrorException () throw () {};
00020 private:
00021   int _idx;
00022 };
00023 
00024 //! \brief Class to allow us to throw a \c ValueError from C++ and have
00025 //!         it make it back to Python
00026 //!
00027 class ValueErrorException : public std::exception
00028 {
00029 public:
00030   ValueErrorException(const std::string i) : _value(i) {};
00031   ValueErrorException(const char *msg) : _value(msg) {};
00032   std::string message () const { return _value; };
00033   ~ValueErrorException () throw () {};
00034 private:
00035   std::string _value;
00036 };
00037 
00038 
00039 //! \brief Class to allow us to throw a \c KeyError from C++ and have
00040 //!         it make it back to Python
00041 //!
00042 class KeyErrorException : public std::exception
00043 {
00044 public:
00045   KeyErrorException(std::string key) : _key(key) {};
00046   std::string key() const { return _key; };
00047   ~KeyErrorException () throw () {};
00048 private:
00049   std::string _key;
00050 };
00051 
00052 #endif

Generated on Sat May 24 08:36:32 2008 for RDCode by  doxygen 1.5.3