IODA Bundle
src/core/FileFormat.h
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2021, Met Office
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef CORE_FILEFORMAT_H_
9 #define CORE_FILEFORMAT_H_
10 
11 #include <string>
12 
13 namespace ioda {
14 
15 /// \brief Observation file format.
16 ///
17 /// \internal If you add a new format, be sure to modify FileFormatParameterTraitsHelper in
18 /// ParameterTraitsFileFormat.h accordingly.
19 enum class FileFormat {
20  /// File format determined automatically from the file name extension (`.odb` -- ODB, everything
21  /// else -- HDF5).
22  AUTO,
23  /// HDF5 file format
24  HDF5,
25  /// ODB file format
26  ODB
27 };
28 
29 /// \brief Determine the format of an observation file.
30 ///
31 /// Returns `hint` unless it's set to FileFormat::AUTO, in which case the function returns
32 /// FileFormat::ODB if `filePath` ends with `.odb` (irrespective of case) and FileFormat::HDF5
33 /// otherwise.
34 FileFormat determineFileFormat(const std::string &filePath, FileFormat hint);
35 
36 } // namespace ioda
37 
38 #endif // CORE_FILEFORMAT_H_
FileFormat
Observation file format.
@ HDF5
HDF5 file format.
@ ODB
ODB file format.
FileFormat determineFileFormat(const std::string &filePath, FileFormat hint)
Determine the format of an observation file.
Definition: FileFormat.cc:13