Skip to content

Commit

Permalink
JInspector: Reset application ticker, timeout to original state
Browse files Browse the repository at this point in the history
This addresses issue #112
  • Loading branch information
nathanwbrei committed Jul 25, 2022
1 parent 7acd2ba commit 0d027b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/libraries/JANA/Utils/JInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,11 @@ void JInspector::PrintObjectAncestors(std::string factory_idx, int object_idx) {

void JInspector::Loop() {
bool stay_in_loop = true;
m_event->GetJApplication()->SetTicker( false ); // TODO: Get the current ticker state first (requires JApplication be modified)
m_event->GetJApplication()->SetTimeoutEnabled( false ); // TODO: Get current state and save
auto app = m_event->GetJApplication();
m_enable_timeout_on_exit = app->IsTimeoutEnabled();
m_enable_ticker_on_exit = app->IsTickerEnabled();
m_event->GetJApplication()->SetTicker( false );
m_event->GetJApplication()->SetTimeoutEnabled( false );
m_out << std::endl;
m_out << "--------------------------------------------------------------------------------------" << std::endl;
m_out << "Welcome to JANA's interactive inspector! Type `Help` or `h` to see available commands." << std::endl;
Expand Down Expand Up @@ -716,6 +719,10 @@ void JInspector::Loop() {
}
}

m_event->GetJApplication()->SetTicker( true ); // TODO: Reset to what it was upon entry
m_event->GetJApplication()->SetTimeoutEnabled( true ); // TODO: Reset to what it was upon entry
if (m_enable_ticker_on_exit) {
m_event->GetJApplication()->SetTicker( true );
}
if (m_enable_timeout_on_exit) {
m_event->GetJApplication()->SetTimeoutEnabled( true );
}
}
2 changes: 2 additions & 0 deletions src/libraries/JANA/Utils/JInspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class JInspector {
std::ostream& m_out = std::cout;
std::istream& m_in = std::cin;
std::set<std::string> m_discrepancies;
bool m_enable_timeout_on_exit = false;
bool m_enable_ticker_on_exit = false;

public:
explicit JInspector(const JEvent* event);
Expand Down

0 comments on commit 0d027b5

Please sign in to comment.