Update of /cvsroot/boost/boost/boost/mpi
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5678/boost/mpi

Modified Files:
        exception.hpp 
Log Message:
Improve messages produced by the exception class

Index: exception.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/mpi/exception.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- exception.hpp       17 Jan 2007 02:48:46 -0000      1.1
+++ exception.hpp       31 May 2007 16:41:49 -0000      1.2
@@ -15,6 +15,7 @@
 
 #include <mpi.h>
 #include <exception>
+#include <string>
 #include <boost/config.hpp>
 #include <boost/throw_exception.hpp>
 
@@ -41,33 +42,47 @@
    *   @param result_code The result code returned from the MPI
    *   routine that aborted with an error.
    */
-  exception(const char* routine, int result_code)
-    : routine_(routine), result_code_(result_code) { }
+  exception(const char* routine, int result_code);
+
+  virtual ~exception() throw();
 
   /**
-   * A description of the error that occured. At present, this refers
-   * only to the name of the MPI routine that failed.
+   * A description of the error that occurred. 
    */
   virtual const char * what () const throw ()
   {
-    return routine_;
+    return this->message.c_str();
   }
 
   /** Retrieve the name of the MPI routine that reported the error. */
   const char* routine() const { return routine_; }
 
   /**
-   * Retrieve the result code returned from the MPI routine that
-   * reported the error.
+   * @brief Retrieve the result code returned from the MPI routine
+   * that reported the error.
    */
   int result_code() const { return result_code_; }
 
+  /**
+   * @brief Returns the MPI error class associated with the error that
+   * triggered this exception.
+   */
+  int error_class() const 
+  { 
+    int result;
+    MPI_Error_class(result_code_, &result);
+    return result;
+  }
+
  protected:
   /// The MPI routine that triggered the error
   const char* routine_;
 
   /// The failed result code reported by the MPI implementation.
   int result_code_;
+
+  /// The formatted error message
+  std::string message;
 };
 
 /**


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to