FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
hdf5_handler.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * @file hdf5_handler.h
10 * @brief Header file for HDF5 data export and import functions.
11 */
12
13#pragma once
14
15#include <string>
16#include <vector>
17
18#include "core/config.h"
19
20namespace HighFive
21{
22 class File;
23}
24
25namespace serial
26{
27 /**
28 * @brief Adds a chunk of data to an HDF5 file.
29 *
30 * @param file The HDF5 file where the chunk is written.
31 * @param data A vector of complex data to be written.
32 * @param time The time attribute associated with the chunk.
33 * @param fullscale The fullscale attribute for the chunk.
34 * @param count The sequential count number for chunk naming.
35 * @throws std::runtime_error If there is an error writing data or setting attributes.
36 */
37 void addChunkToFile(HighFive::File& file, const std::vector<ComplexType>& data, RealType time, RealType fullscale,
38 unsigned count);
39
40 /**
41 * @brief Reads pulse data from an HDF5 file.
42 *
43 * @param name The name of the HDF5 file.
44 * @param data A reference to a vector where the complex data will be stored.
45 * @throws std::runtime_error If the file does not exist or the datasets "I" and "Q" have mismatched sizes.
46 */
47 void readPulseData(const std::string& name, std::vector<ComplexType>& data);
48
49 /**
50 * @brief Reads a 2D pattern dataset from an HDF5 file.
51 *
52 * @param name The name of the HDF5 file.
53 * @param datasetName The name of the dataset to be read.
54 * @return A 2D vector containing the pattern data.
55 * @throws std::runtime_error If there is an error handling the file or if the dataset dimensions are invalid.
56 */
57 std::vector<std::vector<RealType>> readPattern(const std::string& name, const std::string& datasetName);
58}
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
void readPulseData(const std::string &name, std::vector< ComplexType > &data)
Reads pulse data from an HDF5 file.
void addChunkToFile(HighFive::File &file, const std::vector< ComplexType > &data, const RealType time, const RealType fullscale, const unsigned count)
Adds a chunk of data to an HDF5 file.
std::vector< std::vector< RealType > > readPattern(const std::string &name, const std::string &datasetName)
Reads a 2D pattern dataset from an HDF5 file.