Line data Source code
1 : // SPDX-License-Identifier: BSD-3-Clause 2 : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp) 3 : /// @file 4 : /// @author Simon Heybrock 5 : #include <string> 6 : 7 : #include "scipp/variable/element_array_variable.tcc" 8 : #include "scipp/variable/variable.h" 9 : 10 : namespace scipp::variable { 11 : 12 0 : template <> std::string Formatter<Variable>::format(const Variable &var) const { 13 0 : if (var.dims().volume() == 1) 14 0 : return "Variable" + format_variable_like(var.value<Variable>()); 15 0 : return "[multiple variables]"; 16 : } 17 : 18 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(string, std::string) 19 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(float64, double) 20 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(float32, float) 21 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(int64, int64_t) 22 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(int32, int32_t) 23 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(bool, bool) 24 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(datetime64, scipp::core::time_point) 25 : INSTANTIATE_ELEMENT_ARRAY_VARIABLE(Variable, Variable) 26 : 27 : REGISTER_FORMATTER(Variable, Variable) 28 : 29 : } // namespace scipp::variable