Line |
Branch |
Exec |
Source |
1 |
|
|
|
2 |
|
|
/*************************************** |
3 |
|
|
Auteur : Pierre Aubert |
4 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
5 |
|
|
Licence : CeCILL-C |
6 |
|
|
****************************************/ |
7 |
|
|
|
8 |
|
|
#ifndef __TYPE_STREAM_GET_TYPE__ |
9 |
|
|
#define __TYPE_STREAM_GET_TYPE__ |
10 |
|
|
|
11 |
|
|
#include <iostream> |
12 |
|
|
#include <string> |
13 |
|
|
#include <vector> |
14 |
|
|
#include <list> |
15 |
|
|
|
16 |
|
|
#define TYPE_STREAM_CHAR 0lu |
17 |
|
|
#define TYPE_STREAM_SHORT 1lu |
18 |
|
|
#define TYPE_STREAM_INT 2lu |
19 |
|
|
#define TYPE_STREAM_LONG 3lu |
20 |
|
|
#define TYPE_STREAM_UNSIGNED_CHAR 4lu |
21 |
|
|
#define TYPE_STREAM_UNSIGNED_SHORT 5lu |
22 |
|
|
#define TYPE_STREAM_UNSIGNED_INT 6lu |
23 |
|
|
#define TYPE_STREAM_UNSIGNED_LONG 7lu |
24 |
|
|
#define TYPE_STREAM_BOOL 8lu |
25 |
|
|
#define TYPE_STREAM_FLOAT 9lu |
26 |
|
|
#define TYPE_STREAM_DOUBLE 10lu |
27 |
|
|
#define TYPE_STREAM_VOID 11lu |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
///Get the corresponding string of given typename |
31 |
|
|
/** @return corresponding string (default empty string) |
32 |
|
|
*/ |
33 |
|
|
template<typename T> |
34 |
1/1
✓ Branch 2 taken 3 times.
|
5 |
std::string phoenix_getTypeName(){return "UnknownType";} |
35 |
|
|
|
36 |
|
|
///Get the corresponding string of given typename |
37 |
|
|
/** @param val : value of the type to be used |
38 |
|
|
* @return corresponding string (default empty string) |
39 |
|
|
*/ |
40 |
|
|
template<typename T> |
41 |
|
|
std::string phoenix_getTypeName(const T & val){return phoenix_getTypeName<T>();} |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
template<> |
45 |
|
|
std::string phoenix_getTypeName<char>(); |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
template<> |
49 |
|
|
std::string phoenix_getTypeName<short>(); |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
template<> |
53 |
|
|
std::string phoenix_getTypeName<int>(); |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
template<> |
57 |
|
|
std::string phoenix_getTypeName<long>(); |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
template<> |
61 |
|
|
std::string phoenix_getTypeName<unsigned char>(); |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
template<> |
65 |
|
|
std::string phoenix_getTypeName<unsigned short>(); |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
template<> |
69 |
|
|
std::string phoenix_getTypeName<unsigned int>(); |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
template<> |
73 |
|
|
std::string phoenix_getTypeName<unsigned long>(); |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
template<> |
77 |
|
|
std::string phoenix_getTypeName<bool>(); |
78 |
|
|
|
79 |
|
|
|
80 |
|
|
template<> |
81 |
|
|
std::string phoenix_getTypeName<float>(); |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
template<> |
85 |
|
|
std::string phoenix_getTypeName<double>(); |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
template<> |
89 |
|
|
std::string phoenix_getTypeName<void>(); |
90 |
|
|
|
91 |
|
|
#endif |
92 |
|
|
|
93 |
|
|
|