OSDN Git Service

Fix Makefile.am to install headers.
[islib/islib.git] / fatal_error.cpp
1 //
2 // Inclusion of standard header file
3 //
4 #include <algorithm>
5
6 //
7 // Inclusion of local header file
8 //
9 #include "fatal_error.hpp"
10 #include "islibfunc.hpp"
11
12 namespace islib
13   {
14     //
15     // Definition of constructor
16     //
17     fatal_error::fatal_error
18       (
19         char const *message_
20       )
21       throw
22         (
23         )
24       :
25       message ( message_ )
26       {
27         class local
28           {
29           public:
30             local
31               (
32                 char const *message__
33               )
34               {
35                 assert_ ( message__, "islib::fatal_error::fatal_error: `message__' has failed." );
36               }
37
38             ~local
39               (
40               )
41               throw
42                 (
43                 )
44               {
45               }
46           }
47         a_local ( message_ );
48       }
49
50     //
51     // Definition of constructor
52     //
53     fatal_error::fatal_error
54       (
55         this_type const &the_other
56       )
57       throw
58         (
59         )
60       :
61       message ( the_other.message )
62       {
63       }
64
65     //
66     // Definition of destructor
67     //
68     fatal_error::~fatal_error
69       (
70       )
71       throw
72         (
73         )
74       {
75       }
76
77     //
78     // Definition of operator
79     //
80     fatal_error::this_type &
81     fatal_error::operator =
82       (
83         this_type const &right_value
84       )
85       throw
86         (
87         )
88       {
89         this_type temporary ( right_value );
90
91         this->swap ( temporary );
92
93         return *this;
94       }
95
96     //
97     // Definition of method
98     //
99     char const *
100     fatal_error::what
101       (
102       )
103       const
104       throw
105         (
106         )
107       {
108         char const *message_ = 0;
109
110         class local
111           {
112           public:
113             local
114               (
115                 char const * const &message___
116               ):
117               message__ ( message___ )
118               {
119               }
120
121             ~local
122               (
123               )
124               throw
125                 (
126                 )
127               {
128                 assert_ ( this->message__, "islib::fatal_error::what: `this->message' has failed." );
129               }
130
131           private:
132             char const * const &message__;
133           }
134         a_local ( message );
135
136         message_ = this->message;
137
138         return message_;
139       }
140
141     //
142     // Definition of method
143     //
144     void
145     fatal_error::swap
146       (
147         this_type &the_other
148       )
149       throw
150         (
151         )
152       {
153         std::swap ( this->message, the_other.message );
154       }
155   }
156
157 //
158 // End of file
159 //