Program Listing for File csv_data_exporter.hpp

Holoscan v2.1.0

Return to documentation for file (include/holoscan/core/analytics/csv_data_exporter.hpp)

Copy
Copied!
            

/* * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HOLOSCAN_CORE_ANALYTICS_CSVDATA_EXPORTER_HPP #define HOLOSCAN_CORE_ANALYTICS_CSVDATA_EXPORTER_HPP #include <fstream> #include <string> #include <vector> #include "./data_exporter.hpp" namespace holoscan { // The default output file name for analytics data. constexpr const char* kAnalyticsOutputFileName = "data.csv"; class CsvDataExporter : public DataExporter { public: CsvDataExporter(const std::string& app_name, const std::vector<std::string>& columns); ~CsvDataExporter(); void export_data(const std::vector<std::string>& data) override; static expected<std::string, ErrorCode> get_analytics_data_file_name_env(); const std::string& output_file_name() const { return file_name_; } const std::vector<std::string>& columns() const { return columns_; } private: void write_row(const std::vector<std::string>& data); std::string file_name_; std::vector<std::string> columns_; std::ofstream file_; }; } // namespace holoscan #endif/* HOLOSCAN_CORE_ANALYTICS_CSVDATA_EXPORTER_HPP */

© Copyright 2022-2024, NVIDIA. Last updated on Jul 3, 2024.