view trajectorymanagement/src/TrajectoryExceptions.h @ 1219:8a626226793e

update where optimization uses either nomad-parameter file depending on optimizing 1 or 2 steps
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 19 Jun 2023 17:09:56 -0400
parents e1e7acef8eab
children
line wrap: on
line source

#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