STORMM Source Documentation
Loading...
Searching...
No Matches
common_types.h
1// -*-c++-*-
2#ifndef STORMM_COMMON_TYPES_H
3#define STORMM_COMMON_TYPES_H
4
5#include <string>
6#include <typeinfo>
7#include <typeindex>
8#include <sys/types.h>
9#include "copyright.h"
10#include "Reporting/error_format.h"
11
12namespace stormm {
13namespace data_types {
14
17typedef unsigned int uint;
18typedef unsigned long int ulint;
19typedef unsigned long int ulong;
20typedef long long int llint;
21typedef unsigned long long int ullint;
22typedef unsigned short int ushort;
23typedef unsigned char uchar;
25
28static const size_t int_type_index = std::type_index(typeid(int)).hash_code();
29static const size_t longdouble_type_index = std::type_index(typeid(long double)).hash_code();
30static const size_t double_type_index = std::type_index(typeid(double)).hash_code();
31static const size_t float_type_index = std::type_index(typeid(float)).hash_code();
32static const size_t char_type_index = std::type_index(typeid(char)).hash_code();
33static const size_t uchar_type_index = std::type_index(typeid(uchar)).hash_code();
34static const size_t uint_type_index = std::type_index(typeid(uint)).hash_code();
35static const size_t ulint_type_index = std::type_index(typeid(ulint)).hash_code();
36static const size_t llint_type_index = std::type_index(typeid(llint)).hash_code();
37static const size_t ullint_type_index = std::type_index(typeid(ullint)).hash_code();
38static const size_t short_type_index = std::type_index(typeid(short int)).hash_code();
39static const size_t ushort_type_index = std::type_index(typeid(short unsigned int)).hash_code();
40static const size_t bool_type_index = std::type_index(typeid(bool)).hash_code();
41static const size_t size_t_type_index = std::type_index(typeid(size_t)).hash_code();
43
45template <typename T> bool isScalarType();
46
48template <typename T> bool isSignedIntegralScalarType();
49
51template <typename T> bool isUnsignedIntegralScalarType();
52
54template <typename T> bool isFloatingPointScalarType();
55
57template <typename T> std::string getStormmScalarTypeName();
58
59} // namespace data_types
60} // namespace stormm
61
62#include "common_types.tpp"
63
64namespace stormm {
65using data_types::ulint;
66using data_types::ulong;
67using data_types::llint;
68using data_types::ullint;
69using data_types::ushort;
70using data_types::uchar;
71using data_types::longdouble_type_index;
72using data_types::double_type_index;
73using data_types::float_type_index;
74using data_types::char_type_index;
75using data_types::ushort_type_index;
76using data_types::uchar_type_index;
77using data_types::int_type_index;
78using data_types::uint_type_index;
79using data_types::ulint_type_index;
80using data_types::llint_type_index;
81using data_types::ullint_type_index;
82using data_types::short_type_index;
83using data_types::ushort_type_index;
84using data_types::bool_type_index;
85using data_types::size_t_type_index;
86} // namespace stormm
87
88#endif