Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A string utility class and a new Exception (used to throw out of band exception)
[simgrid.git] / src / cxx / Exception.hpp
1 /*\r
2  * Exception.hpp\r
3  *\r
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
5  * All right reserved. \r
6  *\r
7  * This program is free software; you can redistribute \r
8  * it and/or modify it under the terms of the license \r
9  *(GNU LGPL) which comes with this package. \r
10  *\r
11  */  \r
12  \r
13 #ifndef MSG_EXCEPTION_HPP\r
14 #define MSG_EXCEPTION_HPP\r
15 \r
16 #ifndef __cplusplus\r
17         #error Exception.hpp requires C++ compilation (use a .cxx suffix)\r
18 #endif\r
19 \r
20 #include <Config.hpp>\r
21 \r
22 namespace SimGrid\r
23 {\r
24         namespace Msg\r
25         {\r
26                 \r
27                 class SIMGRIDX_EXPORT Exception\r
28                 {\r
29                         public:\r
30                         \r
31                         // Default constructor.\r
32                                 Exception();\r
33                         \r
34                         // Copy constructor.\r
35                                 Exception(const Exception& rException);\r
36                         \r
37                         // This constructor takes the reason of the exception.\r
38                                 Exception(const char* reason);\r
39                         \r
40                         // Destructor.\r
41                                 virtual ~Exception();\r
42                                 \r
43                         // Operations.\r
44                                         \r
45                                         // Returns the reason of the exception.\r
46                                         const char* toString(void) const;\r
47                         \r
48                         // Operators.\r
49                                 \r
50                                 // Assignement.\r
51                                 const Exception& operator = (const Exception& rException);\r
52                                 \r
53                         private :\r
54                         \r
55                         // Attributes.\r
56                                 \r
57                                 // The reason of the exceptions.\r
58                                 const char* reason;\r
59                 };\r
60                 \r
61                 \r
62         } // namespace Msg      \r
63 \r
64 }// namespace SimGrid\r
65 \r
66 \r
67 #endif // !MSG_EXCEPTION_HPP\r
68 \r