mbsim  4.0.0
MBSim Kernel
mbsim_event.h
1/* Copyright (C) 2004-2009 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@googlemail.com
18 */
19
20#ifndef _MBSIM_EVENT_H_
21#define _MBSIM_EVENT_H_
22
23#include <string>
24#include <exception>
25#include <xercesc/dom/DOMElement.hpp>
26#include <mbxmlutilshelper/dom.h>
27
28namespace MBSim {
29
30 class Element;
31 class Solver;
32
39 class MBSimError : public std::exception {
40 public:
46 MBSimError(const Element *context, std::string mbsim_error_message_) noexcept;
47
53 MBSimError(const Solver *context, std::string mbsim_error_message_) noexcept;
54
55 ~MBSimError() noexcept override = default;
56
57 const std::string& getErrorMessage() const { return mbsim_error_message; }
58
59 const std::string& getPath() const { return path; }
60
61 const char* what() const noexcept override;
62
63 private:
68
69 std::string path;
70
71 // domEvalError stores the DOM stack of this error, if available.
72 // It is used in what() to generated the message for whatMsg.
73 mutable MBXMLUtils::DOMEvalException domEvalError;
74
75 // just a string to store the memory which is returned by the what() function
76 mutable std::string whatMsg;
77 };
78}
79
80#endif /* _MBSIM_EVENT_H */
basic class of MBSim mainly for plotting
Definition: element.h:56
basic error class for mbsim
Definition: mbsim_event.h:39
std::string mbsim_error_message
error message
Definition: mbsim_event.h:67
MBSimError(const Element *context, std::string mbsim_error_message_) noexcept
constructor
Definition: mbsim_event.cc:32
solver-interface for dynamic systems
Definition: solver.h:38
namespace MBSim
Definition: bilateral_constraint.cc:30