OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
file.hpp
Go to the documentation of this file.
1//
2// Struct file
3//
4// Copyright (c) 2015, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin
5// All rights reserved
6//
7// This file is part of OPAL.
8//
9// OPAL is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// You should have received a copy of the GNU General Public License
15// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
16//
17#ifndef FILE_HPP_
18#define FILE_HPP_
19
28
29#include <optional>
30#include <ostream>
31
32namespace SDDS {
33 struct file {
35 std::optional<description> sddsDescription_m; // 1
42
43 void clear() {
44 sddsVersion_m = {};
45 sddsDescription_m.reset();
46 sddsParameters_m.clear();
47 sddsColumns_m.clear();
48 sddsData_m = {};
49 sddsAssociates_m.clear();
50 sddsArrays_m.clear();
51 sddsIncludes_m.clear();
52 }
53 };
54
55 inline std::ostream& operator<<(std::ostream& out, const file& fh) {
56 out << fh.sddsVersion_m << "\n";
57 if (fh.sddsDescription_m) out << *fh.sddsDescription_m << "\n";
58 for (const parameter& param: fh.sddsParameters_m) {
59 out << param << "\n";
60 }
61 for (const column& col: fh.sddsColumns_m) {
62 out << col << "\n";
63 }
64 out << fh.sddsData_m << "\n";
65
66// if (fh.sddsAssociates_m) out << *fh.sddsAssociates_m << "\n";
67// if (fh.sddsArrays_m) out << *fh.sddsArrays_m << "\n";
68// if (fh.sddsIncludes_m) out << *fh.sddsIncludes_m << "\n";
69
70 out << std::endl;
71
72 return out;
73 }
74}
75
76#endif /* FILE_HPP_ */
std::ostream & operator<<(std::ostream &out, const array &)
Definition array.hpp:72
version sddsVersion_m
Definition file.hpp:34
std::optional< description > sddsDescription_m
Definition file.hpp:35
columnList sddsColumns_m
Definition file.hpp:37
arrayList sddsArrays_m
Definition file.hpp:40
data sddsData_m
Definition file.hpp:38
includeList sddsIncludes_m
Definition file.hpp:41
void clear()
Definition file.hpp:43
parameterList sddsParameters_m
Definition file.hpp:36
associateList sddsAssociates_m
Definition file.hpp:39