| 1 | /* |
| 2 | * is_csv_writable.hpp |
| 3 | * |
| 4 | * Created on: Jul 18, 2016 |
| 5 | * Author: i-bird |
| 6 | */ |
| 7 | |
| 8 | #ifndef OPENFPM_IO_SRC_CSVWRITER_IS_CSV_WRITABLE_HPP_ |
| 9 | #define OPENFPM_IO_SRC_CSVWRITER_IS_CSV_WRITABLE_HPP_ |
| 10 | |
| 11 | |
| 12 | //! Indicate if the property T is writable in CSV |
| 13 | template<typename T> |
| 14 | struct is_csv_writable |
| 15 | { |
| 16 | //! as default if not recognized is not writable |
| 17 | enum |
| 18 | { |
| 19 | value = false |
| 20 | }; |
| 21 | }; |
| 22 | |
| 23 | //! Indicate if the property T is writable in CSV |
| 24 | template<> |
| 25 | struct is_csv_writable<float> |
| 26 | { |
| 27 | //! float is writable |
| 28 | enum |
| 29 | { |
| 30 | value = true |
| 31 | }; |
| 32 | }; |
| 33 | |
| 34 | //! Indicate if the property T is writable in CSV |
| 35 | template<> |
| 36 | struct is_csv_writable<double> |
| 37 | { |
| 38 | //! double is writable |
| 39 | enum |
| 40 | { |
| 41 | value = true |
| 42 | }; |
| 43 | }; |
| 44 | |
| 45 | //! Indicate if the property T is writable in CSV |
| 46 | template<> |
| 47 | struct is_csv_writable<char> |
| 48 | { |
| 49 | //! char is writable |
| 50 | enum |
| 51 | { |
| 52 | value = true |
| 53 | }; |
| 54 | }; |
| 55 | |
| 56 | //! Indicate if the property T is writable in CSV |
| 57 | template<> |
| 58 | struct is_csv_writable<unsigned char> |
| 59 | { |
| 60 | //! unsigned char is writable |
| 61 | enum |
| 62 | { |
| 63 | value = true |
| 64 | }; |
| 65 | }; |
| 66 | |
| 67 | //! Indicate if the property T is writable in CSV |
| 68 | template<> |
| 69 | struct is_csv_writable<short> |
| 70 | { |
| 71 | //! short is writable |
| 72 | enum |
| 73 | { |
| 74 | value = true |
| 75 | }; |
| 76 | }; |
| 77 | |
| 78 | //! Indicate if the property T is writable in CSV |
| 79 | template<> |
| 80 | struct is_csv_writable<unsigned short> |
| 81 | { |
| 82 | //! unsigned is writable |
| 83 | enum |
| 84 | { |
| 85 | value = true |
| 86 | }; |
| 87 | }; |
| 88 | |
| 89 | //! Indicate if the property T is writable in CSV |
| 90 | template<> |
| 91 | struct is_csv_writable<int> |
| 92 | { |
| 93 | //! int is writable |
| 94 | enum |
| 95 | { |
| 96 | value = true |
| 97 | }; |
| 98 | }; |
| 99 | |
| 100 | //! Indicate if the property T is writable in CSV |
| 101 | template<> |
| 102 | struct is_csv_writable<unsigned int> |
| 103 | { |
| 104 | //! unsigned int is writable |
| 105 | enum |
| 106 | { |
| 107 | value = true |
| 108 | }; |
| 109 | }; |
| 110 | |
| 111 | //! Indicate if the property T is writable in CSV |
| 112 | template<> |
| 113 | struct is_csv_writable<long int> |
| 114 | { |
| 115 | //! long int is writable |
| 116 | enum |
| 117 | { |
| 118 | value = true |
| 119 | }; |
| 120 | }; |
| 121 | |
| 122 | //! Indicate if the property T is writable in CSV |
| 123 | template<> |
| 124 | struct is_csv_writable<unsigned long int> |
| 125 | { |
| 126 | //! unsigned long int is writable |
| 127 | enum |
| 128 | { |
| 129 | value = true |
| 130 | }; |
| 131 | }; |
| 132 | |
| 133 | //! Indicate if the property T is writable in CSV |
| 134 | template<> |
| 135 | struct is_csv_writable<bool> |
| 136 | { |
| 137 | //! bool is writable |
| 138 | enum |
| 139 | { |
| 140 | value = true |
| 141 | }; |
| 142 | }; |
| 143 | |
| 144 | //! Indicate if the property T is writable in CSV |
| 145 | template<typename T, unsigned int N1> |
| 146 | struct is_csv_writable<T[N1]> |
| 147 | { |
| 148 | //! bool is writable |
| 149 | enum |
| 150 | { |
| 151 | value = true |
| 152 | }; |
| 153 | }; |
| 154 | |
| 155 | //! Indicate if the property T is writable in CSV |
| 156 | template<typename T, unsigned int N1, unsigned int N2> |
| 157 | struct is_csv_writable<T[N1][N2]> |
| 158 | { |
| 159 | //! bool is writable |
| 160 | enum |
| 161 | { |
| 162 | value = true |
| 163 | }; |
| 164 | }; |
| 165 | |
| 166 | //! Indicate if the property T is writable in CSV |
| 167 | template<typename T, unsigned int N1, unsigned int N2, unsigned int N3> |
| 168 | struct is_csv_writable<T[N1][N2][N3]> |
| 169 | { |
| 170 | //! bool is writable |
| 171 | enum |
| 172 | { |
| 173 | value = true |
| 174 | }; |
| 175 | }; |
| 176 | |
| 177 | #endif /* OPENFPM_IO_SRC_CSVWRITER_IS_CSV_WRITABLE_HPP_ */ |
| 178 | |