OPAL (Object Oriented Parallel Accelerator Library)
2024.2
OPAL
optimizer
Util
SDDSParser
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 "
Util/SDDSParser/ast.hpp
"
21
22
#include <array>
23
#include <iostream>
24
#include <ostream>
25
#include <string_view>
26
#include <utility>
27
28
namespace
SDDS
{
29
struct
data
{
30
enum class
attributes
{
31
MODE
,
32
LINES_PER_ROW
,
33
NO_ROW_COUNT
,
34
FIXED_ROW_COUNT
,
35
ADDITIONAL_HEADER_LINES
,
36
COLUMN_MAJOR_ORDER
,
37
ENDIAN
38
};
39
40
ast::dataMode
mode_m
{
ast::dataMode::ASCII
};
41
long
numberRows_m
{ 0 };
42
43
bool
isASCII
()
const
{
44
if
(
mode_m
==
ast::dataMode::BINARY
) {
45
std::cerr <<
"can't handle binary data yet"
<< std::endl;
46
return
false
;
47
}
48
return
true
;
49
}
50
51
template
<attributes A>
52
struct
complainUnsupported
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_ */
SDDS
Definition
SDDSParser.h:33
SDDS::operator<<
std::ostream & operator<<(std::ostream &out, const array &)
Definition
array.hpp:72
SDDS::ast::getDataModeString
constexpr std::string_view getDataModeString(dataMode mode)
Definition
ast.hpp:97
SDDS::ast::dataMode
dataMode
Definition
ast.hpp:39
SDDS::ast::dataMode::BINARY
@ BINARY
SDDS::ast::dataMode::ASCII
@ ASCII
SDDS::data
Definition
data.hpp:29
SDDS::data::isASCII
bool isASCII() const
Definition
data.hpp:43
SDDS::data::mode_m
ast::dataMode mode_m
Definition
data.hpp:40
SDDS::data::attributes
attributes
Definition
data.hpp:30
SDDS::data::attributes::ADDITIONAL_HEADER_LINES
@ ADDITIONAL_HEADER_LINES
SDDS::data::attributes::ENDIAN
@ ENDIAN
SDDS::data::attributes::COLUMN_MAJOR_ORDER
@ COLUMN_MAJOR_ORDER
SDDS::data::attributes::NO_ROW_COUNT
@ NO_ROW_COUNT
SDDS::data::attributes::FIXED_ROW_COUNT
@ FIXED_ROW_COUNT
SDDS::data::attributes::MODE
@ MODE
SDDS::data::attributes::LINES_PER_ROW
@ LINES_PER_ROW
SDDS::data::numberRows_m
long numberRows_m
Definition
data.hpp:41
SDDS::data::complainUnsupported
Definition
data.hpp:53
SDDS::data::complainUnsupported::apply
static bool apply()
Definition
data.hpp:54
ast.hpp
Generated on Wed Sep 30 2026 07:14:50 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.8