OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
data.hpp
Go to the documentation of this file.
1//
2// Struct data
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 DATA_HPP_
18#define DATA_HPP_
19
21
22#include <array>
23#include <iostream>
24#include <ostream>
25#include <string_view>
26#include <utility>
27
28namespace SDDS {
29 struct data {
39
41 long numberRows_m { 0 };
42
43 bool isASCII() const {
45 std::cerr << "can't handle binary data yet" << std::endl;
46 return false;
47 }
48 return true;
49 }
50
51 template <attributes A>
53 {
54 static bool apply() {
55 constexpr std::array<std::pair<attributes, std::string_view>, 6> unsupportedAttributeNames = {{
56 { attributes::LINES_PER_ROW, "lines_per_row" },
57 { attributes::NO_ROW_COUNT, "no_row_count" },
58 { attributes::FIXED_ROW_COUNT, "fixed_row_count" },
59 { attributes::ADDITIONAL_HEADER_LINES, "additional_header_lines" },
60 { attributes::COLUMN_MAJOR_ORDER, "column_major_order" },
61 { attributes::ENDIAN, "endian" }
62 }};
63
64 for (const auto& item : unsupportedAttributeNames) {
65 if (item.first == A) {
66 std::cerr << item.second << " not supported yet" << std::endl;
67 return false;
68 }
69 }
70
71 return true;
72 }
73 };
74 };
75
76 inline std::ostream& operator<<(std::ostream& out, const data& data_) {
77 out << "mode = " << ast::getDataModeString(data_.mode_m);
78 return out;
79 }
80}
81
82// Data parsing is now handled by SimpleParser
83#endif /* DATA_HPP_ */
std::ostream & operator<<(std::ostream &out, const array &)
Definition array.hpp:72
constexpr std::string_view getDataModeString(dataMode mode)
Definition ast.hpp:97
bool isASCII() const
Definition data.hpp:43
ast::dataMode mode_m
Definition data.hpp:40
long numberRows_m
Definition data.hpp:41