Skip to content

Commit 3034b64

Browse files
authored
DPL: add helper to printout current state (#5126)
1 parent 10a62f7 commit 3034b64

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

Framework/Core/include/Framework/DriverInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ struct DriverInfo {
142142
bool noSHMCleanup;
143143
};
144144

145+
struct DriverInfoHelper {
146+
static char const* stateToString(enum DriverState state);
147+
};
148+
145149
} // namespace o2::framework
146150

147151
#endif // O2_FRAMEWORK_DRIVERINFO_H_

Framework/Core/src/DriverInfo.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,22 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010
#include "Framework/DriverInfo.h"
11+
12+
char const* o2::framework::DriverInfoHelper::stateToString(enum DriverState state)
13+
{
14+
static const char* names[static_cast<int>(DriverState::LAST)] = {
15+
"INIT", //
16+
"SCHEDULE", //
17+
"RUNNING", //
18+
"REDEPLOY_GUI", //
19+
"QUIT_REQUESTED", //
20+
"HANDLE_CHILDREN", //
21+
"EXIT", //
22+
"UNKNOWN", //
23+
"PERFORM_CALLBACKS", //
24+
"MATERIALISE_WORKFLOW", //
25+
"IMPORT_CURRENT_WORKFLOW", //
26+
"DO_CHILD" //
27+
};
28+
return names[static_cast<int>(state)];
29+
}

Framework/GUISupport/src/FrameworkGUIDebugger.cxx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -691,25 +691,6 @@ void popWindowColorDueToStatus()
691691
ImGui::PopStyleVar(1);
692692
}
693693

694-
struct DriverHelper {
695-
static char const* stateToString(enum DriverState state)
696-
{
697-
static const char* names[static_cast<int>(DriverState::LAST)] = {
698-
"INIT", //
699-
"SCHEDULE", //
700-
"RUNNING", //
701-
"GUI", //
702-
"REDEPLOY_GUI", //
703-
"QUIT_REQUESTED", //
704-
"HANDLE_CHILDREN", //
705-
"EXIT", //
706-
"UNKNOWN" //
707-
"PERFORM_CALLBACKS" //
708-
};
709-
return names[static_cast<int>(state)];
710-
}
711-
};
712-
713694
/// Display information window about the driver
714695
/// and its state.
715696
void displayDriverInfo(DriverInfo const& driverInfo, DriverControl& driverControl)
@@ -775,7 +756,7 @@ void displayDriverInfo(DriverInfo const& driverInfo, DriverControl& driverContro
775756
}
776757

777758
for (size_t i = 0; i < driverInfo.states.size(); ++i) {
778-
ImGui::Text("#%lu: %s", i, DriverHelper::stateToString(driverInfo.states[i]));
759+
ImGui::Text("#%lu: %s", i, DriverInfoHelper::stateToString(driverInfo.states[i]));
779760
}
780761

781762
ImGui::End();

0 commit comments

Comments
 (0)