23 #include <aws/core/utils/logging/LogMacros.h> 65 const std::function<
void()> & pre_record =
nullptr,
66 const std::function<
void(
int)> & post_record =
nullptr 70 std::lock_guard<std::mutex> lock(
mutex_);
72 AWS_LOG_INFO(__func__,
"Failed to run RosbagRecorder, recorder already active");
75 AWS_LOG_INFO(__func__,
"Starting a new RosbagRecorder session");
76 static auto function_name = __func__;
77 barrier_ = std::async(std::launch::async, [recorder_options, pre_record, post_record]
84 T rosbag_recorder(recorder_options);
85 exit_code = rosbag_recorder.Run();
88 AWS_LOGSTREAM_ERROR(function_name,
"RosbagRecorder encountered an error (code: " << exit_code <<
')');
91 post_record(exit_code);
101 using namespace std::chrono_literals;
102 auto status =
barrier_.wait_for(0ms);
103 return std::future_status::ready != status;
virtual RosbagRecorderRunResult Run(const RecorderOptions &recorder_options, const std::function< void()> &pre_record=nullptr, const std::function< void(int)> &post_record=nullptr)
virtual bool IsActive() const
std::future< void > barrier_
virtual ~RosbagRecorder()=default