Last change
on this file since 368 was
335,
checked in by ymipsl, 13 years ago
|
Change namespace xmlioserver -> xios
YM
|
File size:
1.4 KB
|
Line | |
---|
1 | #include "exception.hpp" |
---|
2 | |
---|
3 | /// boost headers /// |
---|
4 | #include <boost/cast.hpp> |
---|
5 | |
---|
6 | namespace xios |
---|
7 | { |
---|
8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
9 | CException::CException(void) |
---|
10 | : CObject(), desc_rethrow(true) |
---|
11 | { /* Ne rien faire de plus */ } |
---|
12 | |
---|
13 | CException::CException(const StdString & id) |
---|
14 | : CObject(id), desc_rethrow(true) |
---|
15 | { /* Ne rien faire de plus */ } |
---|
16 | |
---|
17 | CException::CException(const CException & exception) |
---|
18 | : std::basic_ios<char>() |
---|
19 | , CObject(exception.getId()) |
---|
20 | , StdOStringStream() |
---|
21 | , desc_rethrow(false) |
---|
22 | { (*this) << exception.str(); } |
---|
23 | |
---|
24 | CException::~CException(void) |
---|
25 | { |
---|
26 | if (desc_rethrow) |
---|
27 | #ifdef __XIOS_NOABORT |
---|
28 | throw (*this); |
---|
29 | #else |
---|
30 | std::cerr << this->getMessage() << std::endl; |
---|
31 | abort(); |
---|
32 | #endif |
---|
33 | } |
---|
34 | |
---|
35 | //--------------------------------------------------------------- |
---|
36 | |
---|
37 | StdString CException::getMessage(void) const |
---|
38 | { |
---|
39 | StdOStringStream oss; |
---|
40 | oss << "> Error [" << this->getId() << "] : " << this->str(); |
---|
41 | return (oss.str()); |
---|
42 | } |
---|
43 | |
---|
44 | StdOStringStream & CException::getStream(void) |
---|
45 | { return (*boost::polymorphic_cast<StdOStringStream*>(this)); } |
---|
46 | |
---|
47 | StdString CException::toString(void) const |
---|
48 | { return (StdString(this->getMessage())); } |
---|
49 | |
---|
50 | void CException::fromString(const StdString & str) |
---|
51 | { this->str(str); } |
---|
52 | |
---|
53 | //--------------------------------------------------------------- |
---|
54 | |
---|
55 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.