SheafSystem  0.0.0.0
primitive_traits.cc
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Implementation for class template primitive_traits.
19 
20 #include "SheafSystem/primitive_traits.h"
21 #include "SheafSystem/error_message.h"
22 #include "SheafSystem/std_hdf5.h"
23 
24 // Definitions of primitive_traits::hdf_type given here to encapsulate hdf.
28 
30 {
31  return H5T_NATIVE_B8;
32 }
33 
35 {
36  return H5T_NATIVE_CHAR;
37 }
38 
40 {
41  return H5T_NATIVE_SCHAR;
42 }
43 
45 {
46  return H5T_NATIVE_SHORT;
47 }
48 
50 {
51  return H5T_NATIVE_INT;
52 }
53 
55 {
56  return H5T_NATIVE_LONG;
57 }
58 
60 {
61  return H5T_NATIVE_LLONG;
62 }
63 
65 {
66  return H5T_NATIVE_UCHAR;
67 }
68 
70 {
71  return H5T_NATIVE_USHORT;
72 }
73 
75 {
76  return H5T_NATIVE_UINT;
77 }
78 
80 {
81  return H5T_NATIVE_ULONG;
82 }
83 
85 {
86  return H5T_NATIVE_ULLONG;
87 }
88 
90 {
91  return H5T_NATIVE_FLOAT;
92 }
93 
95 {
96  return H5T_NATIVE_DOUBLE;
97 }
98 
100 {
101  return H5T_NATIVE_LDOUBLE;
102 }
103 
105 {
106  int result = -1;
107  if(sizeof(void*) == sizeof(unsigned int))
108  {
109  result = H5T_NATIVE_UINT;
110  }
111  else if(sizeof(void*) == sizeof(unsigned long))
112  {
113  result = H5T_NATIVE_ULONG;
114  }
115  else if(sizeof(void*) == sizeof(unsigned long long))
116  {
117  result = H5T_NATIVE_ULLONG;
118  }
119  else
120  {
121  post_fatal_error_message("Unable to match sheaf primitive void_star with HDF type.");
122  }
123 
124  return result;
125 }
126 
128 {
129  return H5T_C_S1;
130 }
131 
133 {
134  // The sheaf type is a struct with this type as the type of its members.
135  // See file_data_type_map::create_internal_hdf_types().
136 
137  return H5T_NATIVE_INT;
138 }
139 
141 {
142  // The sheaf type is a struct with this type as the type of its members.
143  // See file_data_type_map::create_internal_hdf_types().
144 
145  return H5T_NATIVE_INT;
146 }
147 
149 {
150  // The sheaf type is a struct with this type as the type of its members.
151  // See file_data_type_map::create_internal_hdf_types().
152 
153  return -1;
154 }
155 
156 
157 
158 
static int hdf_type()
The hdf type used to represent T in the hdf file.