/usr/include/roboptim/core/solver-error.hh is in libroboptim-core-dev 2.0-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | // Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA.
//
// This file is part of the roboptim.
//
// roboptim is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// roboptim is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with roboptim. If not, see <http://www.gnu.org/licenses/>.
#ifndef ROBOPTIM_CORE_SOLVER_ERROR_HH
# define ROBOPTIM_CORE_SOLVER_ERROR_HH
# include <roboptim/core/sys.hh>
# include <roboptim/core/debug.hh>
# include <iostream>
# include <stdexcept>
# include <boost/optional.hpp>
# include <roboptim/core/result.hh>
namespace roboptim
{
/// \addtogroup roboptim_problem
/// @{
/// \brief Base exception class for solving errors.
/// All other exceptions classes concerning the optimization
/// process should inherits this class.
class ROBOPTIM_DLLAPI SolverError : public std::runtime_error
{
public:
/// \brief Instantiate an error from an error message.
/// \param arg error message.
explicit SolverError (const std::string& arg) throw ();
/// \brief Instantiate an error from an error message.
/// \param arg error message.
/// \param res last state of the solver.
SolverError (const std::string& arg,
const Result& res) throw ();
/// \brief Copy constructor.
/// \param error other error to copy.
SolverError (const SolverError& error) throw ();
/// \brief Trivial destructor.
~SolverError() throw();
/// \brief Display the error on the specified output stream.
///
/// \param o output stream used for display
/// \return output stream
virtual std::ostream& print (std::ostream&) const throw ();
/// \brief Retrieve the (optional) last state of the solver.
/// \return last state of the solver.
const boost::optional<Result>& lastState () const throw ();
/// \brief Retrieve the (optional) last state of the solver.
/// \return last state of the solver.
boost::optional<Result>& lastState () throw ();
private:
/// \brief (Optional) Last state of the solver before the error was raised.
///
/// \warning This piece of data may be completely unusable, and comes
/// without any warranty of any kind.
boost::optional<Result> lastState_;
};
/// @}
/// \brief Override operator<< to handle error display.
///
/// \param o output stream used for display
/// \param e error to be displayed
/// \return output stream
ROBOPTIM_DLLAPI std::ostream& operator<< (std::ostream& o,
const SolverError& e);
} // end of namespace roboptim
#endif //! ROBOPTIM_CORE_SOLVER_ERROR_HH
|