#include <exception>
#include <stdexcept>
-#include <xbt/exception.hpp>
+#include <string>
+#include <type_traits>
+#include <vector>
+#include <xbt/backtrace.h>
+#include <xbt/backtrace.hpp>
+#include <xbt/base.h>
#include <xbt/ex.h>
+#include <xbt/log.h>
+#include <xbt/misc.h> // xbt_procname
+#include <xbt/virtu.h> // xbt_getpid
namespace simgrid {
+namespace xbt {
+
+/** The location of where an exception has been thrown
+ *
+ * This is a tuple (__FILE__, __LINE__, __func__), created with @ref XBT_THROW_POINT.
+ *
+ * @ingroup XBT_ex
+ */
+class ThrowPoint {
+public:
+ ThrowPoint() = default;
+ explicit ThrowPoint(const char* file, int line, const char* function) : file_(file), line_(line), function_(function)
+ {
+ }
+ const char* file_ = nullptr;
+ int line_ = 0;
+ const char* function_ = nullptr;
+};
+
+/** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */
+#define XBT_THROW_POINT ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__)
+
+/** A base class for exceptions with context
+ *
+ * This is a base class for exceptions which store additional contextual
+ * information: backtrace, throw point, simulated process name, PID, etc.
+ */
+class XBT_PUBLIC ContextedException {
+public:
+ ContextedException() : backtrace_(simgrid::xbt::backtrace()), procname_(xbt_procname()), pid_(xbt_getpid()) {}
+ explicit ContextedException(Backtrace bt) : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid())
+ {
+ }
+ explicit ContextedException(ThrowPoint throwpoint, Backtrace bt)
+ : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()), throwpoint_(throwpoint)
+ {
+ }
+ virtual ~ContextedException();
+ Backtrace const& backtrace() const { return backtrace_; }
+ int pid() const { return pid_; }
+ std::string const& process_name() const { return procname_; }
+ ThrowPoint& throw_point() { return throwpoint_; }
+
+ // deprecated
+ XBT_ATTRIB_DEPRECATED_v323("Please use WithContextException::process_name()") std::string const& processName() const
+ {
+ return process_name();
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use WithContextException::throw_point()") ThrowPoint& throwPoint()
+ {
+ return throw_point();
+ }
+
+private:
+ Backtrace backtrace_;
+ std::string procname_; /**< Name of the process who thrown this */
+ int pid_; /**< PID of the process who thrown this */
+ ThrowPoint throwpoint_;
+};
+} // namespace xbt
/** Ancestor class of all SimGrid exception */
class Exception : public std::runtime_error {
+++ /dev/null
-/* Copyright (c) 2005-2018. The SimGrid Team.All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef SIMGRID_XBT_EXCEPTION_HPP
-#define SIMGRID_XBT_EXCEPTION_HPP
-
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include <xbt/base.h>
-#include <xbt/backtrace.h>
-#include <xbt/backtrace.hpp>
-#include <xbt/log.h>
-#include <xbt/misc.h> // xbt_procname
-#include <xbt/virtu.h> // xbt_getpid
-
-/** @addtogroup XBT_ex
- * @brief Exceptions support
- */
-
-namespace simgrid {
-namespace xbt {
-
-/** The location of where an exception has been thrown
- *
- * This is a tuple (__FILE__, __LINE__, __func__) and can be created with
- * @ref XBT_THROW_POINT.
- *
- * @ingroup XBT_ex
- */
-class ThrowPoint {
- public:
- ThrowPoint() = default;
- explicit ThrowPoint(const char* file, int line, const char* function) : file_(file), line_(line), function_(function)
- {
- }
- const char* file_ = nullptr;
- int line_ = 0;
- const char* function_ = nullptr;
-};
-
-/** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */
-#define XBT_THROW_POINT ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__)
-
-/** A base class for exceptions with context
- *
- * This is a base class for exceptions which store additional contextual
- * information: backtrace, throw point, simulated process name, PID, etc.
- */
-class XBT_PUBLIC ContextedException {
-public:
- ContextedException() :
- backtrace_(simgrid::xbt::backtrace()),
- procname_(xbt_procname()),
- pid_(xbt_getpid())
- {}
- explicit ContextedException(Backtrace bt) : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid())
- {}
- explicit ContextedException(ThrowPoint throwpoint, Backtrace bt)
- : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()), throwpoint_(throwpoint)
- {}
- virtual ~ContextedException();
- Backtrace const& backtrace() const
- {
- return backtrace_;
- }
- int pid() const { return pid_; }
- std::string const& process_name() const { return procname_; }
- ThrowPoint& throw_point() { return throwpoint_; }
-
- // deprecated
- XBT_ATTRIB_DEPRECATED_v323("Please use WithContextException::process_name()") std::string const& processName() const
- {
- return process_name();
- }
- XBT_ATTRIB_DEPRECATED_v323("Please use WithContextException::throw_point()") ThrowPoint& throwPoint()
- {
- return throw_point();
- }
-
-private:
- Backtrace backtrace_;
- std::string procname_; /**< Name of the process who thrown this */
- int pid_; /**< PID of the process who thrown this */
- ThrowPoint throwpoint_;
-};
-}
-}
-
-#endif
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <simgrid/Exception.hpp>
#include <xbt/log.h>
-#include <xbt/exception.hpp>
namespace simgrid {
namespace xbt {
#include <exception>
#include <mutex>
-#include <xbt/exception.hpp>
-#include <xbt/log.hpp>
-
+#include "simgrid/Exception.hpp"
#include "simgrid/barrier.h"
#include "simgrid/s4u/Barrier.hpp"
#include "simgrid/simix.h"
+#include "xbt/log.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_barrier, "S4U barrier");
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <exception>
-#include <mutex>
-
-#include <xbt/exception.hpp>
-#include <xbt/log.hpp>
-
#include "simgrid/s4u/ConditionVariable.hpp"
#include "simgrid/simix.h"
#include "src/kernel/activity/ConditionVariableImpl.hpp"
+#include "xbt/log.hpp"
+
+#include <exception>
+#include <mutex>
namespace simgrid {
namespace s4u {