Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
type_name_info.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
21#include <string>
22
23namespace shambase {
24
25 template<class T>
26 struct TypeNameInfo {
27 static_assert(
29 "This name was not specialized, please either include the file with the definiton or "
30 "add a new one");
31 inline static const std::string name = "";
32 };
33
34 template<class T>
35 std::string get_type_name() {
37 }
38
39} // namespace shambase
40
41namespace shambase {
42
43 template<>
44 struct TypeNameInfo<i64> {
45 inline static const std::string name = "i64";
46 };
47 template<>
48 struct TypeNameInfo<i32> {
49 inline static const std::string name = "i32";
50 };
51 template<>
52 struct TypeNameInfo<i16> {
53 inline static const std::string name = "i16";
54 };
55 template<>
56 struct TypeNameInfo<i8> {
57 inline static const std::string name = "i8";
58 };
59 template<>
60 struct TypeNameInfo<u64> {
61 inline static const std::string name = "u64";
62 };
63 template<>
64 struct TypeNameInfo<u32> {
65 inline static const std::string name = "u32";
66 };
67 template<>
68 struct TypeNameInfo<u16> {
69 inline static const std::string name = "u16";
70 };
71 template<>
72 struct TypeNameInfo<u8> {
73 inline static const std::string name = "u8";
74 };
75
76 template<>
77 struct TypeNameInfo<f64> {
78 inline static const std::string name = "f64";
79 };
80 template<>
81 struct TypeNameInfo<f32> {
82 inline static const std::string name = "f32";
83 };
84
85} // namespace shambase
double f64
Alias for double.
float f32
Alias for float.
std::int8_t i8
8 bit integer
std::uint8_t u8
8 bit unsigned integer
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
std::uint16_t u16
16 bit unsigned integer
std::int16_t i16
16 bit integer
std::int64_t i64
64 bit integer
std::int32_t i32
32 bit integer
namespace for basic c++ utilities
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Traits for C++ types.