File record_replay.hpp

File List > astutedds > dcps > record_replay.hpp

Go to the documentation of this file

//
// Copyright (c) 2026, Astute Systems PTY LTD
//
// This file is part of the Astute DDS developed by Astute Systems.
//
// See the commercial LICENSE file in the project root for full license details.
//
// @file record_replay.hpp
// @brief Data logging and replay utilities for DCPS samples
//

#ifndef ASTUTEDDS_DCPS_RECORD_REPLAY_HPP
#define ASTUTEDDS_DCPS_RECORD_REPLAY_HPP

#include <astutedds/dcps/dds_psm_types.hpp>
#include <cstdint>
#include <string>
#include <vector>

namespace astutedds::dcps
{

    class DomainParticipant;

    struct LoggedSample
    {
        uint64_t relative_timestamp_ns{0};
        std::string topic_name;
        std::vector<uint8_t> payload;
    };

    class DataLogTool
    {
    public:
        static ReturnCode_t write_samples(const std::string &file_path,
                                          const std::vector<LoggedSample> &samples);

        static ReturnCode_t read_samples(const std::string &file_path,
                                         std::vector<LoggedSample> &samples);

        static ReturnCode_t replay_samples(DomainParticipant &participant,
                                           const std::vector<LoggedSample> &samples);
    };

} // namespace astutedds::dcps

#endif // ASTUTEDDS_DCPS_RECORD_REPLAY_HPP