bpp-popgen  3.0.0
GeneralExceptions.cpp
Go to the documentation of this file.
1 //
2 // File GeneralExceptions.cpp
3 // Author : Sylvain Gaillard
4 // Last modification: Thursday July 29 2004
5 //
6 
7 /*
8  Copyright or © or Copr. CNRS, (November 17, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for population genetics analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #include "GeneralExceptions.h"
41 
42 #include <Bpp/Text/TextTools.h>
43 
44 using namespace bpp;
45 using namespace std;
46 
47 // ** BadIdentifierException **************************************************/
48 
50  const size_t id) : Exception("BadIdentifierException: " +
51  string(text) + "(" + TextTools::toString(id) + ")"),
52  id_(TextTools::toString(id)) {}
53 
55  const size_t id) : Exception("BadIdentifierException: " +
56  text + "(" + TextTools::toString(id) + ")"),
57  id_(TextTools::toString(id)) {}
58 
60  const std::string& id) : Exception("BadIdentifierException: " + string(text) +
61  "(" + id + ")"),
62  id_(id) {}
63 
65  const std::string& id) : Exception("BadIdentifierException: " + text +
66  "(" + id + ")"),
67  id_(id) {}
68 
70 
71 const std::string BadIdentifierException::getIdentifier() const
72 {
73  return id_;
74 }
75 
76 // ** LocusNotFoundException **************************************************/
77 
79  const size_t id) : BadIdentifierException("LocusNotFoundException: " +
80  string(text) + "(" + TextTools::toString(id) + ")",
81  id) {}
82 
84  const size_t id) : BadIdentifierException("LocusNotFoundException: " +
85  text + "(" + TextTools::toString(id) + ")",
86  id) {}
87 
89  const std::string& id) : BadIdentifierException("LocusNotFoundException: " + string(text) +
90  "(" + id + ")",
91  id) {}
92 
94  const std::string& id) : BadIdentifierException("LocusNotFoundException: " + text +
95  "(" + id + ")",
96  id) {}
97 
99 
100 const std::string LocusNotFoundException::getIdentifier() const
101 {
103 }
104 
105 // ** AlleleNotFoundException **************************************************/
106 
108  const size_t id) : BadIdentifierException("AlleleNotFoundException: " +
109  string(text) + "(" + TextTools::toString(id) + ")",
110  id) {}
111 
113  const size_t id) : BadIdentifierException("AlleleNotFoundException: " +
114  text + "(" + TextTools::toString(id) + ")",
115  id) {}
116 
118  const std::string& id) : BadIdentifierException("AlleleNotFoundException: " + string(text) +
119  "(" + id + ")",
120  id) {}
121 
123  const std::string& id) : BadIdentifierException("AlleleNotFoundException: " + text +
124  "(" + id + ")",
125  id) {}
126 
128 
129 const std::string AlleleNotFoundException::getIdentifier() const
130 {
132 }
133 
134 // ** LocalityNotFoundException **************************************************/
135 
137  const size_t id) : BadIdentifierException("LocalityNotFoundException: " +
138  string(text) + "(" + TextTools::toString(id) + ")",
139  id) {}
140 
142  const size_t id) : BadIdentifierException("LocalityNotFoundException: " +
143  text + "(" + TextTools::toString(id) + ")",
144  id) {}
145 
147  const std::string& id) : BadIdentifierException("LocalityNotFoundException: " + string(text) +
148  "(" + id + ")",
149  id) {}
150 
152  const std::string& id) : BadIdentifierException("LocalityNotFoundException: " + text +
153  "(" + id + ")",
154  id) {}
155 
157 
159 {
161 }
162 
163 // ** IndividualNotFoundException **************************************************/
164 
166  const size_t id) : BadIdentifierException("IndividualNotFoundException: " +
167  string(text) + "(" + TextTools::toString(id) + ")",
168  id) {}
169 
171  const size_t id) : BadIdentifierException("IndividualNotFoundException: " +
172  text + "(" + TextTools::toString(id) + ")",
173  id) {}
174 
176  const std::string& id) : BadIdentifierException("IndividualNotFoundException: " + string(text) +
177  "(" + id + ")",
178  id) {}
179 
181  const std::string& id) : BadIdentifierException("IndividualNotFoundException: " + text +
182  "(" + id + ")",
183  id) {}
184 
186 
188 {
190 }
191 
192 // ** GroupNotFoundException **************************************************/
193 
195  const size_t id) : BadIdentifierException("GroupNotFoundException: " +
196  string(text) + "(" + TextTools::toString(id) + ")",
197  id) {}
198 
200  const size_t id) : BadIdentifierException("GroupNotFoundException: " +
201  text + "(" + TextTools::toString(id) + ")",
202  id) {}
203 
205  const std::string& id) : BadIdentifierException("GroupNotFoundException: " + string(text) +
206  "(" + id + ")",
207  id) {}
208 
210  const std::string& id) : BadIdentifierException("GroupNotFoundException: " + text +
211  "(" + id + ")",
212  id) {}
213 
215 
216 const std::string GroupNotFoundException::getIdentifier() const
217 {
219 }
220 
AlleleNotFoundException(const char *text, size_t id)
Build the exception with a numerical identifier.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
The BadIdentifierException class.
BadIdentifierException(const char *text, size_t id)
Build the exception with a numerical identifier.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
GroupNotFoundException(const char *text, size_t id)
Build the exception with a numerical identifier.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
IndividualNotFoundException(const char *text, size_t id)
Build the exception with a numerical identifier.
LocalityNotFoundException(const char *text, size_t id)
Build the exception with a numerical identifier.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
LocusNotFoundException(const char *text, size_t id)
Build the exception with a numerical identifier.
std::string toString(T t)