Mercurial Hosting > traffic-intelligence
comparison trajectorymanagement/src/TrajectoryExceptions.h @ 1159:e1e7acef8eab
moved trajectory management library into Traffic Intelligence
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 22 Feb 2021 22:09:35 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1158:7eb972942f22 | 1159:e1e7acef8eab |
---|---|
1 #ifndef TRAJECTORY_EXCEPTIONS_H | |
2 #define TRAJECTORY_EXCEPTIONS_H | |
3 | |
4 #include <exception> | |
5 #include <sstream> | |
6 | |
7 /** | |
8 * TrajectoryFrameNumberErrorException class. | |
9 */ | |
10 class TrajectoryFrameNumberErrorException: public std::exception { | |
11 /** | |
12 * Return the name of the exception. | |
13 * | |
14 * @return The name of the exception | |
15 */ | |
16 virtual const char* what() const throw () | |
17 { | |
18 return "TrajectoryFrameNumberErrorException"; | |
19 } | |
20 }; | |
21 | |
22 /** | |
23 * TrajectoryLengthErrorException class. | |
24 * | |
25 * The TrajectoryLengthError exception should be invoked when a length of a trajectory is incorrect. | |
26 */ | |
27 class TrajectoryLengthErrorException: public std::exception { | |
28 /** | |
29 * Return the name of the exception. | |
30 * | |
31 * @return The name of the exception | |
32 */ | |
33 virtual const char* what() const throw () | |
34 { | |
35 return "TrajectoryLengthErrorException"; | |
36 } | |
37 }; | |
38 | |
39 /** | |
40 * TrajectoryOutOfRangeErrorException class. | |
41 */ | |
42 class TrajectoryOutOfRangeErrorException: public std::exception { | |
43 public: | |
44 TrajectoryOutOfRangeErrorException(const unsigned int& _i = -1) | |
45 : i(_i) {} | |
46 | |
47 protected: | |
48 int i; | |
49 | |
50 /** | |
51 * Return the name of the exception. | |
52 * | |
53 * @return The name of the exception | |
54 */ | |
55 virtual const char* what() const throw () | |
56 { | |
57 std::stringstream ss; | |
58 ss << "TrajectoryOutOfRangeErrorException: " << i; | |
59 return ss.str().c_str(); | |
60 } | |
61 }; | |
62 | |
63 #endif |