]> Creatis software - gdcm.git/blobdiff - src/gdcmException.cxx
Coding Style + Doxygenation
[gdcm.git] / src / gdcmException.cxx
index f51f6e4c787253f03401efada3dbaaf25e8918f1..21184b7826c56d7adaa6b462d677bfba2df830f3 100644 (file)
@@ -3,12 +3,12 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmException.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/08/16 04:25:18 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2005/01/06 20:03:27 $
+  Version:   $Revision: 1.23 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
-  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
                                                                                 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #include "gdcmException.h"
 
 #include <typeinfo>
-#include <stdio.h>
+namespace gdcm 
+{
 
 //-----------------------------------------------------------------------------
-// gdcmException
+// Exception
 
 /**
- * \ingroup gdcmException
+ * \ingroup Exception
  * \brief constructor
  * @param f
  * @param msg  
  */
-gdcmException::gdcmException(const std::string &f, const std::string& msg) throw()
+Exception::Exception(const std::string &f, const std::string &msg) throw()
 #ifdef __GNUC__
   try
 #endif
@@ -38,17 +39,17 @@ gdcmException::gdcmException(const std::string &f, const std::string& msg) throw
   }
 #ifdef __GNUC__
 catch(...) {
-  fatal("gdcmException::gdcmException(const std::string&, const std::string&, const std::string&)");
+  fatal("Exception::Exception(const std::string&, const std::string&, const std::string&)");
 }
 #endif
 
 
 /**
- * \ingroup gdcmException
+ * \ingroup Exception
  * \brief fatal
  * @param from 
  */
-void gdcmException::fatal(const char *from) throw() {
+void Exception::fatal(const char *from) throw() {
    try
    {
       std::cerr << "Fatal: exception received in " << from 
@@ -71,16 +72,17 @@ void gdcmException::fatal(const char *from) throw() {
 }
 
 /**
- * \ingroup gdcmException
+ * \ingroup Exception
  * \brief getName
  * @return string
  */
-std::string gdcmException::getName() const throw()
+std::string Exception::getName() const throw()
 {
    try
    {
-#ifdef __GNUC__   // GNU C++ compiler class name demangling
-      unsigned int nested = 1, i, nb, offset;
+#if defined(__GNUC__) && 0   // GNU C++ compiler class name demangling
+      unsigned int nested = 1, i, nb;
+      int offset;
       std::string one;
 
       std::string name;
@@ -100,8 +102,8 @@ std::string gdcmException::getName() const throw()
       }
       return name;
 #else           // no class name demangling
-      //name = typeid(*this).name();
-      return "Exception";
+      std::string name = typeid(*this).name();
+      return name;
 #endif
   }
   catch(...) {
@@ -111,26 +113,26 @@ std::string gdcmException::getName() const throw()
 }
 
 /**
- * \ingroup gdcmException
- * \brief gdcmException
+ * \ingroup Exception
+ * \brief Exception
  */
gdcmException::operator const char *() const throw() {
+ Exception::operator const char *() const throw() {
   return getName().c_str();
 }
 
 //-----------------------------------------------------------------------------
 /**
- * \ingroup gdcmException
- * \brief gdcmException::operator <<
+ * \ingroup Exception
+ * \brief Exception::operator <<
  */
- std::ostream& operator<<(std::ostream &os, const gdcmException &e) {
+ std::ostream& operator<<(std::ostream &os, const Exception &e) {
   try {  
     os << "Exception " << e.getName() << " thrown: " << e.getError() << std::endl;
   }
   catch(...) {
-    gdcmException::fatal("operator<<(std::ostream &, const gdcmException&)");
+    Exception::fatal("operator<<(std::ostream &, const Exception&)");
   }
   return os;
 }
-
+} // end namespace gdcm
 //-----------------------------------------------------------------------------