RepastHPC  2.3.1
RelogoErrors.h
1 /*
2  * Repast for High Performance Computing (Repast HPC)
3  *
4  * Copyright (c) 2010 Argonne National Laboratory
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with
8  * or without modification, are permitted provided that the following
9  * conditions are met:
10  *
11  * Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * Neither the name of the Argonne National Laboratory nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *
35  * ReLogoErrors.h
36  *
37  * Created on: Feb 22, 2012
38  * Author: JTM
39  */
40 
41 #ifndef RELOGO_ERRORS_H
42 #define RELOGO_ERRORS_H
43 
44 #include <sstream>
45 #include <vector>
46 #include <stdexcept>
47 
48 #include "repast_hpc/RepastErrors.h"
49 
50 #include <boost/lexical_cast.hpp>
51 
52 namespace repast{
53 namespace relogo{
54 
55 
56 /* Canonical List of ReLogo Errors */
57 
58 /* ERROR 1 */
59 class ReLogo_Error_1: public std::invalid_argument{
60 public:
61  ReLogo_Error_1(std::string name): INVALID_ARG(ERROR_NUMBER 1)
62  THROWN_BY "Observer::findNetwork(const std::string& name)"
63  REASON "The default directed network must be created before using it"
64  EXPLANATION "'Find Network' was called before the specified network '" + name + "' was created; "
65  CAUSE "Unknown"
66  RESOLUTION "Ensure that the network is created before any attempt to use it is made"
67 END_ERR
68 
69 
70 /* ERROR 2 */
71 class ReLogo_Error_2: public std::invalid_argument{
72 public:
73  ReLogo_Error_2(std::string name): INVALID_ARG(ERROR_NUMBER 2)
74  THROWN_BY "Observer::findNetwork(const std::string& name)"
75  REASON "The default undirected network must be created before using it"
76  EXPLANATION "'Find Network' was called before the specified network '" + name + "' was created; "
77  CAUSE "Unknown"
78  RESOLUTION "Ensure that the network is created before any attempt to use it is made"
79 END_ERR
80 
81 
82 /* ERROR 3 */
83 class ReLogo_Error_3: public std::invalid_argument{
84 public:
85  ReLogo_Error_3(std::string name): INVALID_ARG(ERROR_NUMBER 3)
86  THROWN_BY "Observer::findNetwork(const std::string& name)"
87  REASON "A network must be created before using it"
88  EXPLANATION "'Find Network' was called before the specified network '" + name + "' was created; " +
89  "the network was not found."
90  CAUSE "Unknown"
91  RESOLUTION "Ensure that the network is created before any attempt to use it is made"
92 END_ERR
93 
94 /* TEMPLATE
95 class ReLogo_Error_: public std::invalid_argument{
96 public:
97  ReLogo_Error_(): INVALID_ARG(ERROR_NUMBER 00)
98  THROWN_BY ""
99  REASON ""
100  EXPLANATION ""
101  CAUSE ""
102  RESOLUTION ""
103 END_ERR
104 */
105 
106 } // End ReLogo namespace
107 } // End Repast namespace
108 
109 #endif /* RELOGO_ERRORS_H */