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 | |
---|
9 | namespace 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 |
---|