• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/export/development/ViennaMath/viennamath/exception.hpp

Go to the documentation of this file.
00001 #ifndef VIENNAMATH_EXCEPTION_HPP
00002 #define VIENNAMATH_EXCEPTION_HPP
00003 
00004 /* =======================================================================
00005    Copyright (c) 2012, Institute for Microelectronics,
00006                        Institute for Analysis and Scientific Computing,
00007                        TU Wien.
00008                              -----------------
00009                ViennaMath - Symbolic and Numerical Math in C++
00010                              -----------------
00011 
00012    Author:     Karl Rupp                          rupp@iue.tuwien.ac.at
00013 
00014    License:    MIT (X11), see file LICENSE in the ViennaMath base directory
00015 ======================================================================= */
00016 
00017 
00018 #include <string>
00019 #include <vector>
00020 #include <exception>
00021 #include <sstream>
00022 #include <memory>
00023 
00028 namespace viennamath
00029 {
00030 
00032   struct integration_without_integral_exception : std::exception
00033   {
00034     const char* what() const throw() { return "Cannot integrate an expression if there is no integral."; }
00035   };
00036 
00038   struct symbolic_integral_evaluation_not_possible_exception : std::exception
00039   {
00040     const char* what() const throw() { return "The evaluation of an integral with a symbolic integration domain is not possible."; }
00041   };
00042   
00043 
00045   struct analytic_integration_not_supported_exception : std::exception
00046   {
00047     const char* what() const throw() { return "The current release of ViennaMath does not support analytic integrations at runtime."; }
00048   };
00049   
00050   
00052   struct no_rhs_provided_exception  : std::exception
00053   {
00054     const char* what() const throw() { return "Error due to wrong use of class 'op_interface': No right hand side provided for binary operator."; }
00055   };
00056   
00058   struct rhs_provided_for_unary_operation_exception : std::exception
00059   {
00060     const char* what() const throw() { return "Error due to wrong use of class 'op_interface': A right hand side argument was provided to an unary operator."; }
00061   };
00062   
00063   
00064   
00065 
00069   class expression_not_evaluable_exception : public std::exception
00070   {
00071     public:
00072       expression_not_evaluable_exception() : message_("Expression cannot be unwrapped!") {};
00073       expression_not_evaluable_exception(std::string const & str) : message_(str) {};
00074       
00075       virtual ~expression_not_evaluable_exception() throw () {};
00076       
00077     private:
00078       const char * what() const throw() { return message_.c_str(); } 
00079       
00080       std::string message_;
00081   };
00082   
00083 
00087   class expression_not_unwrappable_exception : public std::exception
00088   {
00089     public:
00090       expression_not_unwrappable_exception() : message_("Expression cannot be unwrapped!") {};
00091       expression_not_unwrappable_exception(std::string const & str) : message_(str) {};
00092       
00093       virtual ~expression_not_unwrappable_exception() throw () {};
00094       
00095     private:
00096       const char * what() const throw() { return message_.c_str(); } 
00097       
00098       std::string message_;
00099   };
00100   
00104   class expression_not_differentiable_exception : public std::exception
00105   {
00106     public:
00107       expression_not_differentiable_exception() : message_("Expression not differentiable!") {};
00108       expression_not_differentiable_exception(std::string const & str) : message_(str) {};
00109       
00110       virtual ~expression_not_differentiable_exception() throw () {};
00111       
00112     private:
00113       const char * what() const throw() { return message_.c_str(); } 
00114       
00115       std::string message_;
00116   };
00117   
00118   
00119   
00123   class variable_index_out_of_bounds_exception : public std::exception
00124   {
00125     const char * what() const throw()
00126     {
00127       std::stringstream ss;
00128       ss << "Encountered an variable<> type with id larger or equal to the size of the supplied vector of values. id=" << id_ << ", vector_size=" << vector_size_ << std::endl;
00129       return ss.str().c_str();
00130     } 
00131     
00132     public:
00133       variable_index_out_of_bounds_exception(long id, long vector_size) : id_(id), vector_size_(vector_size) {}
00134       
00135     private:
00136       long id_;
00137       long vector_size_;
00138   };
00139   
00140   
00141 }
00142 
00143 #endif

Generated on Wed Feb 29 2012 21:50:43 for ViennaMath by  doxygen 1.7.1