Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tf_cast.h
1/*******************************************************************************
2 * This file is part of Tissue Forge.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
20#ifndef _SOURCE_TYPES_TF_CAST_H_
21#define _SOURCE_TYPES_TF_CAST_H_
22
23#include <stdexcept>
24#include <string>
25#include <vector>
26
27
28namespace TissueForge {
29
30
31 template<typename T, typename S>
32 S cast(const T&);
33
34 template<typename T, typename S>
35 S cast(T*);
36
37 template<> std::string cast(const int &t);
38
39 template<> std::string cast(const long &t);
40
41 template<> std::string cast(const long long &t);
42
43 template<> std::string cast(const unsigned int &t);
44
45 template<> std::string cast(const unsigned long &t);
46
47 template<> std::string cast(const unsigned long long &t);
48
49 template<> std::string cast(const bool &t);
50
51 template<> std::string cast(const float &t);
52
53 template<> std::string cast(const double &t);
54
55 template<> std::string cast(const long double &t);
56
57 template<> int cast(const std::string &s);
58
59 template<> long cast(const std::string &s);
60
61 template<> long long cast(const std::string &s);
62
63 template<> unsigned int cast(const std::string &s);
64
65 template<> unsigned long cast(const std::string &s);
66
67 template<> unsigned long long cast(const std::string &s);
68
69 template<> bool cast(const std::string &s);
70
71 template<> float cast(const std::string &s);
72
73 template<> double cast(const std::string &s);
74
75 template<> long double cast(const std::string &s);
76
77 template<typename T, typename S>
78 bool check(const T&);
79
80 template<typename T>
81 bool check(const std::string&);
82
83 template<> bool check<int>(const std::string &s);
84
85 template<> bool check<long>(const std::string &s);
86
87 template<> bool check<long long>(const std::string &s);
88
89 template<> bool check<unsigned int>(const std::string &s);
90
91 template<> bool check<unsigned long>(const std::string &s);
92
93 template<> bool check<unsigned long long>(const std::string &s);
94
95 template<> bool check<bool>(const std::string &s);
96
97 template<> bool check<float>(const std::string &s);
98
99 template<> bool check<double>(const std::string &s);
100
101 template<> bool check<long double>(const std::string &s);
102
103}
104
105#endif // _SOURCE_TYPES_TF_CAST_H_
bool check(PyObject *o)
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26