1 #include "artdaq/DAQdata/Globals.hh"
2 #define TRACE_NAME (app_name + "_DataLoggerApp").c_str()
4 #include "artdaq-core/Utilities/ExceptionHandler.hh"
5 #include "artdaq/Application/DataLoggerApp.hh"
6 #include "artdaq/Application/DataLoggerCore.hh"
8 #include <boost/lexical_cast.hpp>
24 if (DataLogger_ptr_ ==
nullptr)
26 DataLogger_ptr_ = std::make_unique<DataLoggerCore>();
33 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
42 external_request_status_ = DataLogger_ptr_->start(
id);
43 if (!external_request_status_)
45 report_string_ =
"Error starting ";
46 report_string_.append(app_name +
" ");
47 report_string_.append(
"for run number ");
48 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
49 report_string_.append(
".");
52 return external_request_status_;
58 external_request_status_ = DataLogger_ptr_->stop();
59 if (!external_request_status_)
61 report_string_ =
"Error stopping ";
62 report_string_.append(app_name +
".");
65 return external_request_status_;
71 external_request_status_ = DataLogger_ptr_->pause();
72 if (!external_request_status_)
74 report_string_ =
"Error pausing ";
75 report_string_.append(app_name +
".");
78 return external_request_status_;
84 external_request_status_ = DataLogger_ptr_->resume();
85 if (!external_request_status_)
87 report_string_ =
"Error resuming ";
88 report_string_.append(app_name +
".");
91 return external_request_status_;
97 external_request_status_ = DataLogger_ptr_->shutdown();
98 if (!external_request_status_)
100 report_string_ =
"Error shutting down ";
101 report_string_.append(app_name +
".");
104 return external_request_status_;
119 std::string resultString;
122 if (which ==
"transition_status")
124 if (report_string_.length() > 0) {
return report_string_; }
138 if (DataLogger_ptr_ !=
nullptr)
140 resultString.append(DataLogger_ptr_->report(which));
144 resultString.append(
"This DataLogger has not yet been initialized and ");
145 resultString.append(
"therefore can not provide reporting.");
154 external_request_status_ = DataLogger_ptr_->add_config_archive_entry(key, value);
155 if (!external_request_status_)
157 report_string_ =
"Error adding config entry with key ";
158 report_string_.append(key +
" and value \"");
159 report_string_.append(value +
"\" in");
160 report_string_.append(app_name +
".");
163 return external_request_status_;
169 external_request_status_ = DataLogger_ptr_->clear_config_archive();
170 if (!external_request_status_)
172 report_string_ =
"Error clearing the configuration archive in ";
173 report_string_.append(app_name +
".");
176 return external_request_status_;
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t) override
Initialize the DataLoggerCore.
DataLoggerApp()
DataLoggerApp Constructor.
bool do_shutdown(uint64_t) override
Shutdown the DataLoggerCore.
bool external_request_status_
Whether the last command succeeded.
bool do_soft_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Soft-initialize the DataLoggerCore. No-Op.
bool do_resume(uint64_t, uint64_t) override
Resume the DataLoggerCore.
bool do_pause(uint64_t, uint64_t) override
Pause the DataLoggerCore.
std::string report(std::string const &which) const override
If which is "transition_status", report the status of the last transition. Otherwise pass through to ...
bool do_reinitialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Reinitialize the DataLoggerCore. No-Op.
std::string report_string_
Status information about the last command.
bool do_clear_config_archive() override
Clear the configuration archive list in the DataLoggerCore.
bool do_start(art::RunID id, uint64_t, uint64_t) override
Start the DataLoggerCore.
bool do_add_config_archive_entry(std::string const &, std::string const &) override
Add the specified configuration archive entry to the DataLoggerCore.
bool do_stop(uint64_t, uint64_t) override
Stop the DataLoggerCore.