Commit 9c1b9ca4 authored by Dominik Charousset's avatar Dominik Charousset

added `exit_reason::as_string`

parent cf4655f2
......@@ -116,6 +116,7 @@ set(LIBCPPA_SRC
src/empty_tuple.cpp
src/event_based_actor.cpp
src/exception.cpp
src/exit_reason.cpp
src/factory.cpp
src/fd_util.cpp
src/fiber.cpp
......
......@@ -291,3 +291,4 @@ unit_testing/test_uniform_type.cpp
unit_testing/test_yield_interface.cpp
cppa/memory_cached_mixin.hpp
unit_testing/test.cpp
src/exit_reason.cpp
......@@ -82,6 +82,8 @@ static constexpr std::uint32_t remote_link_unreachable = 0x00101;
*/
static constexpr std::uint32_t user_defined = 0x10000;
const char* as_string(std::uint32_t value);
} } // namespace cppa::exit_reason
#endif // CPPA_EXIT_REASON_HPP
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011-2013 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa 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. *
* *
* libcppa 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 libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#include "cppa/exit_reason.hpp"
namespace cppa { namespace exit_reason {
namespace { constexpr const char* s_names_table[] = {
"not_exited",
"normal",
"unhandled_exception",
"unallowed_function_call",
"unhandled_sync_failure",
"unhandled_sync_timeout"
}; }
const char* as_string(std::uint32_t value) {
if (value <= unhandled_sync_timeout) return s_names_table[value];
if (value == remote_link_unreachable) return "remote_link_unreachable";
if (value >= user_defined) return "user_defined";
return "illegal_exit_reason";
}
} } // namespace cppa::exit_reason
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment