Program Listing for File ascwriter.h#

Return to documentation for file (ascformat\ascwriter.h)

/********************************************************************************
 * Copyright (c) 2025-2026 ZF Friedrichshafen AG
 *
 * This program and the accompanying materials are made available under the
 * terms of the Apache License Version 2.0 which is available at
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Contributors:
 *   Erik Verhoeven - initial API and implementation
 ********************************************************************************/

#ifndef ASC_FILE_WRITER_H
#define ASC_FILE_WRITER_H

#include "ascreader.h"
#include <list>
#include <chrono>

namespace asc
{
    class CAscWriter
    {
    public:
        CAscWriter();

        void StartTimer();

        void AddSample(const SCanMessage& rsSample);

        bool HasSamples() const;

        void Clear();

        bool Write(const std::filesystem::path& rpathFile);

    private:
        std::list<SCanMessage>                              m_lstMessages;
        std::chrono::high_resolution_clock::time_point      m_timepointStart;
        std::chrono::system_clock::time_point               m_timepointSystem;
    };
}

#endif // !defined ASC_FILE_WRITER_H