diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trajectorymanagement/src/TrajectoryExceptions.h	Mon Feb 22 22:09:35 2021 -0500
@@ -0,0 +1,63 @@
+#ifndef TRAJECTORY_EXCEPTIONS_H
+#define TRAJECTORY_EXCEPTIONS_H
+
+#include <exception>
+#include <sstream>
+
+/**
+ * TrajectoryFrameNumberErrorException class.
+ */
+class TrajectoryFrameNumberErrorException: public std::exception {
+	/**
+	 * Return the name of the exception.
+	 *
+	 * @return The name of the exception
+	 */
+	virtual const char* what() const throw ()
+	{
+		return "TrajectoryFrameNumberErrorException";
+	}
+};
+
+/**
+ * TrajectoryLengthErrorException class.
+ *
+ * The TrajectoryLengthError exception should be invoked when a length of a trajectory is incorrect.
+ */
+class TrajectoryLengthErrorException: public std::exception {
+	/**
+	 * Return the name of the exception.
+	 *
+	 * @return The name of the exception
+	 */
+	virtual const char* what() const throw ()
+	{
+		return "TrajectoryLengthErrorException";
+	}
+};
+
+/**
+ * TrajectoryOutOfRangeErrorException class.
+ */
+class TrajectoryOutOfRangeErrorException: public std::exception {
+ public:
+ TrajectoryOutOfRangeErrorException(const unsigned int& _i = -1)
+   : i(_i) {}
+  
+ protected:
+  int i;
+  
+  /**
+   * Return the name of the exception.
+   *
+   * @return The name of the exception
+   */
+  virtual const char* what() const throw ()
+  {
+    std::stringstream ss;
+    ss << "TrajectoryOutOfRangeErrorException: " << i;
+    return  ss.str().c_str();
+  }
+};
+
+#endif