OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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
20#include "ast.hpp"
21#include "error_handler.hpp"
22#include "skipper.hpp"
23
24namespace SDDS {
25 struct data {
35
38
39 bool isASCII() const {
40 if (mode_m == ast::BINARY) {
41 std::cerr << "can't handle binary data yet" << std::endl;
42 return false;
43 }
44 return true;
45 }
46
47 template <attributes A>
49 static bool apply() {
50 std::string attributeString;
51 switch (A) {
52 case LINES_PER_ROW:
53 attributeString = "lines_per_row";
54 break;
55 case NO_ROW_COUNT:
56 attributeString = "no_row_count";
57 break;
58 case FIXED_ROW_COUNT:
59 attributeString = "fixed_row_count";
60 break;
62 attributeString = "additional_header_lines";
63 break;
65 attributeString = "column_major_order";
66 break;
67 case ENDIAN:
68 attributeString = "endian";
69 break;
70 default:
71 return true;
72 }
73 std::cerr << attributeString << " not supported yet" << std::endl;
74 return false;
75 }
76 };
77 };
78
79 inline std::ostream& operator<<(std::ostream& out, const data& data_) {
80 out << "mode = " << data_.mode_m;
81 return out;
82 }
83} // namespace SDDS
84
85// Data parsing is now handled by SimpleParser
86#endif /* DATA_HPP_ */
@ BINARY
Definition ast.hpp:28
std::ostream & operator<<(std::ostream &out, const array &)
Definition array.hpp:87
bool isASCII() const
Definition data.hpp:39
@ LINES_PER_ROW
Definition data.hpp:28
@ FIXED_ROW_COUNT
Definition data.hpp:30
@ COLUMN_MAJOR_ORDER
Definition data.hpp:32
@ ADDITIONAL_HEADER_LINES
Definition data.hpp:31
@ NO_ROW_COUNT
Definition data.hpp:29
long numberRows_m
Definition data.hpp:37
ast::datamode mode_m
Definition data.hpp:36