Skip to content

Commit

Permalink
Use magic_enum to get enum name.
Browse files Browse the repository at this point in the history
  • Loading branch information
drslebedev committed Nov 22, 2023
1 parent 4745dfc commit 6e59c6a
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions core/include/gnuradio-4.0/Block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <map>

#include <fmt/format.h>
#include <magic_enum.hpp>
#include <magic_enum_utility.hpp>

#include <gnuradio-4.0/meta/typelist.hpp>
#include <gnuradio-4.0/meta/utils.hpp>
Expand All @@ -28,22 +30,6 @@ using gr::meta::fixed_string;

enum class LifeCycleState : char { IDLE, INITIALISED, RUNNING, REQUESTED_STOP, REQUESTED_PAUSE, STOPPED, PAUSED, ERROR };

std::string
lifeCycleStateToString(LifeCycleState state) {
switch (state) {
using enum LifeCycleState;
case IDLE: return "IDLE";
case INITIALISED: return "INITIALISED";
case RUNNING: return "RUNNING";
case REQUESTED_STOP: return "REQUESTED_STOP";
case REQUESTED_PAUSE: return "REQUESTED_PAUSE";
case STOPPED: return "STOPPED";
case PAUSED: return "PAUSED";
case ERROR: return "ERROR";
default: return "Unknown State";
}
}

template<typename F>
constexpr void
simd_epilogue(auto width, F &&fun) {
Expand Down Expand Up @@ -990,7 +976,7 @@ struct Block : protected std::tuple<Arguments...> {
constexpr bool kIsSourceBlock = TInputTypes::size == 0;
constexpr bool kIsSinkBlock = TOutputTypes::size == 0;

// fmt::println("\nworkInternal BEGIN:{}, state:{}, isSource:{}, isSink:{}", name, lifeCycleStateToString(state), kIsSourceBlock, kIsSinkBlock);
// fmt::println("\nworkInternal BEGIN:{}, state:{}, isSource:{}, isSink:{}", name, magic_enum::enum_name(state.load()), kIsSourceBlock, kIsSinkBlock);

if (state == LifeCycleState::STOPPED) {
return { requested_work, 0_UZ, work::Status::DONE };
Expand Down

0 comments on commit 6e59c6a

Please sign in to comment.