Salome HOME
correct small problem from the version in the MedFileV2_2 branch.
[modules/med.git] / src / MEDMEM / MEDMEM_Exception.cxx
index 7f37110a480970fd318e7343c58becc3f32ecb0f..ccd7c216a8cbf846e37a26c8d72a4bf84618b385 100644 (file)
@@ -8,6 +8,7 @@ using namespace std;
 
 #include "utilities.h"
 #include "MEDMEM_Exception.hxx"
+using namespace MEDMEM;
 
 extern "C"
 {
@@ -17,8 +18,11 @@ extern "C"
 }
 
 
+/*!
+  \internal
+  Function used to duplicate char * 
+*/
 const char* duplicate( const char *const str ) ;
-
 const char* duplicate( const char *const str )
 {
        ASSERT(str!=NULL) ;
@@ -30,14 +34,25 @@ const char* duplicate( const char *const str )
        return new_str ;
 }
 
+/*!
+  \internal Default Constructor (Should not be used)
+*/
+// ------------------------------------------------------ //
 MEDEXCEPTION::MEDEXCEPTION( void ): exception() , _text(0)
+// ------------------------------------------------------ //
 {
   MESSAGE( "You must user the standard builder : MEDEXCEPTION::MEDEXCEPTION( const char *text )" ) ;
   INTERRUPTION(1) ;
 }
 
 
+/*!
+  \internal
+  Function used to elaborate the text of the MEDEXCEPTION
+*/
+// --------------------------------------------------------------------------------------- //
 const char *makeText( const char *text, const char *fileName, const unsigned int lineNumber )
+// --------------------------------------------------------------------------------------- //
 {
   char *newText = 0 ;
 
@@ -48,7 +63,7 @@ const char *makeText( const char *text, const char *fileName, const unsigned int
   const size_t l0 = strlen(prefix) ;
 
   if ( fileName )
-    {
+  {
       const size_t l2 = strlen(fileName) ;
 
       ASSERT(lineNumber>=1) ;
@@ -59,24 +74,38 @@ const char *makeText( const char *text, const char *fileName, const unsigned int
       sprintf( newText , "%s in %s [%u] : %s" , prefix, fileName, lineNumber, text ) ;
       ASSERT(newText[l4-1] == '\0' );
 
-    }
+  }
   else
-    {
+  {
       newText = new char [ l0+l1+3+1 ] ;
       sprintf( newText , "%s : %s" , prefix, text ) ;
-    }
+   }
   ASSERT(newText) ;
   return newText ;
 }
 
-
-MEDEXCEPTION::MEDEXCEPTION( const char *text, const char *fileName, const unsigned int lineNumber ) : exception(), _text( makeText( text , fileName , lineNumber ) )
+/*!
+    Constructor : \n
+    It will create the text of the MEDEXCEPTION from the different parameters.
+    It will take the form : \n
+    MEDEXCEPTION, fileName, lineNumber and text of the exception
+*/
+// ------------------------------------------------------------------------------------------------ //
+MEDEXCEPTION::MEDEXCEPTION( const char *text, const char *fileName, const unsigned int lineNumber ) : 
+             exception(), _text( makeText( text , fileName , lineNumber ) )
+// ------------------------------------------------------------------------------------------------ //
 {
   MESSAGE(_text);
 }
 
+/*!
+  Destructor : \n
+  If necessary desallocates Memory
+*/
 
+// ------------------------------------//
 MEDEXCEPTION::~MEDEXCEPTION() throw ()
+// ------------------------------------//
 {
   if ( _text )
     {
@@ -88,22 +117,33 @@ MEDEXCEPTION::~MEDEXCEPTION() throw ()
 }
 
 
-
+/*!
+  Copy Constructor : \n
+  Should not be used very often
+*/
+// ----------------------------------------------------------------------- //
 MEDEXCEPTION::MEDEXCEPTION( const MEDEXCEPTION &ex ): _text(duplicate(ex._text))
+// ----------------------------------------------------------------------- //
 {
   ;
 }
-
-
-ostream & operator<<( ostream &os , const MEDEXCEPTION &ex )
+/*!
+  Operator << : put the message to the given stream.
+*/
+// ------------------------------------------------------- //
+ostream & MEDMEM::operator<<( ostream &os , const MEDEXCEPTION &ex )
+// ------------------------------------------------------- //
 {
   os << ex._text ;
   return os ;
 }
 
-
-
+/*!
+  Return a char * which contain the message.
+*/
+// ------------------------------------------------- //
 const char* MEDEXCEPTION::what( void ) const throw ()
+// ------------------------------------------------- //
 {
   return _text ;
 }