Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shambase
include
shambase
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
19
#include "
shambase/aliases_float.hpp
"
20
#include "
shambase/type_traits.hpp
"
21
#include <string>
22
23
namespace
shambase
{
24
25
template
<
class
T>
26
struct
TypeNameInfo
{
27
static_assert
(
28
always_false_v<T>
,
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() {
36
return
TypeNameInfo<T>::name
;
37
}
38
39
}
// namespace shambase
40
41
namespace
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
aliases_float.hpp
f64
double f64
Alias for double.
Definition
aliases_float.hpp:20
f32
float f32
Alias for float.
Definition
aliases_float.hpp:19
i8
std::int8_t i8
8 bit integer
Definition
aliases_int.hpp:25
u8
std::uint8_t u8
8 bit unsigned integer
Definition
aliases_int.hpp:29
u32
std::uint32_t u32
32 bit unsigned integer
Definition
aliases_int.hpp:27
u64
std::uint64_t u64
64 bit unsigned integer
Definition
aliases_int.hpp:26
u16
std::uint16_t u16
16 bit unsigned integer
Definition
aliases_int.hpp:28
i16
std::int16_t i16
16 bit integer
Definition
aliases_int.hpp:24
i64
std::int64_t i64
64 bit integer
Definition
aliases_int.hpp:22
i32
std::int32_t i32
32 bit integer
Definition
aliases_int.hpp:23
shambase
namespace for basic c++ utilities
Definition
sycl_builtins.hpp:25
shambase::throw_with_loc
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Definition
exception.hpp:132
type_traits.hpp
Traits for C++ types.
shambase::TypeNameInfo
Definition
type_name_info.hpp:26
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8