source: XIOS/trunk/src/exception.cpp @ 1704

Last change on this file since 1704 was 1622, checked in by oabramkina, 5 years ago

Exception handling on trunk.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 1.7 KB
Line 
1#include "exception.hpp"
2
3/// boost headers ///
4#include <boost/cast.hpp>
5#include "client.hpp"
6#include "server.hpp"
7#include "log.hpp"
8
9namespace xios
10{
11  /// ////////////////////// Définitions ////////////////////// ///
12   CException::CException(void)
13      : CObject(), desc_rethrow(true), stream()
14   { /* Ne rien faire de plus */ }
15
16   CException::CException(const std::string & id)
17      : CObject(id), desc_rethrow(true), stream()
18   { /* Ne rien faire de plus */ }
19
20   CException::CException(const CException & exception)
21//      : std::basic_ios<char>()
22       : CObject(exception.getId())
23//      , StdOStringStream()
24//      , desc_rethrow(false)
25   { (*this) << exception.str(); }
26
27   CException::~CException(void)
28   {
29//      if (desc_rethrow)
30//#ifdef __XIOS_NOABORT
31//      {
32//        throw (*this);
33//      }
34//#else
35//     {
36//      error << this->getMessage() << std::endl;
37//        throw 4;
38//      MPI_Abort(CXios::globalComm, -1); //abort();
39//      }
40//#endif
41   }
42
43   //---------------------------------------------------------------
44
45   std::string CException::getMessage(void) const
46   {
47//     StdOStringStream oss;
48//     oss << "> Error [" << this->getId() << "] : " << this->str();
49//     return (oss.str());
50     return (stream.str());
51   }
52
53   StdOStringStream &  CException::getStream(void)
54//   { return (*boost::polymorphic_cast<StdOStringStream*>(this)); }
55   { return stream; }
56
57   std::string CException::toString(void) const
58//   { return (std::string(this->getMessage())); }
59   { return stream.str(); }
60
61   void CException::fromString(const std::string & str)
62   { }
63//   { this->str(str); }
64
65   //---------------------------------------------------------------
66
67} // namespace xios
Note: See TracBrowser for help on using the repository browser.