OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
array.hpp
Go to the documentation of this file.
1//
2// Struct array
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 ARRAY_HPP_
18#define ARRAY_HPP_
19
20#include <array>
21#include <iostream>
22#include <list>
23#include <ostream>
24#include <string_view>
25#include <utility>
26
27namespace SDDS {
28 struct array {
29 enum class attributes {
30 NAME,
31 SYMBOL,
32 UNITS,
36 TYPE,
39 ARRAY
40 };
41
42 template <attributes A>
44 static bool apply() {
45 constexpr std::array<std::pair<attributes, std::string_view>, 10> unsupportedAttributeNames = {{
46 { attributes::NAME, "name" },
47 { attributes::SYMBOL, "symbol" },
48 { attributes::UNITS, "units" },
49 { attributes::DESCRIPTION, "description" },
50 { attributes::FORMAT_STRING, "format_string" },
51 { attributes::GROUP_NAME, "group_name" },
52 { attributes::TYPE, "type" },
53 { attributes::FIELD_LENGTH, "field_length" },
54 { attributes::DIMENSIONS, "dimensions" },
55 { attributes::ARRAY, "array" }
56 }};
57
58 for (const auto& item : unsupportedAttributeNames) {
59 if (item.first == A) {
60 std::cerr << item.second << " not supported yet" << std::endl;
61 return false;
62 }
63 }
64
65 return true;
66 }
67 };
68 };
69
70 struct arrayList : std::list<array> {};
71
72 inline std::ostream& operator<<(std::ostream& out, const array&) {
73 return out;
74 }
75}
76
77#endif /* ARRAY_HPP_ */
std::ostream & operator<<(std::ostream &out, const array &)
Definition array.hpp:72