aboutsummaryrefslogtreecommitdiff
path: root/doc/html/DataTypes.html
blob: 80423ae1462ad1ce7d1ebdf398c553aaec190b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>DataTypes</title>
  </head>
  <body bgcolor="#F0F0F0">
  <body>
    <font face="arial,helvetica" color="#555588"><h1>DataTypes</h1></font>
    HDF and IEEEIO must be able to store any of the basic datatypes
    available to a given computer architecture (various sized integers 
    and floating point numbers).  In Fortran the datatype is
    identified by an integer.  In C we use <b>#defines</b>.  In C++ we
    use <b>enums</b>.  There are also simple built-in utility operations
      available which allow computation of data space used by these
      various datatypes (<i>
      <a href="#sizeof">sizeOf()</a>, 
      <a href="#nelements">nElements()</a>, 
      <a href="#nbytes">nBytes()</a>
      </i>)<p>

Here is how the types are related.<p>

<table border=1>
<tr>
<td> <font face="arial,helvetica" color="#885533"><b>Datatype</b></font></td>
<td> <font face="arial,helvetica" color="#885533"><b>Num Bytes</b></font></td>
<td> <font face="arial,helvetica" color="#885533"><b>C++ TypeID</b></font></td>
<td> <font face="arial,helvetica" color="#885533"><b>C TypeID</b></font></td>
<td> <font face="arial,helvetica" color="#885533"><b>Fortran TypeID</b></font></td>
</tr>

<tr>
<td>byte binary data <i>(not to be confused with text/strings)</i>
<td>1
<td>Byte,Int8
<td>BYTE,INT8
<td>0
<tr>

<td>short (16bit) integer
<td>2
<td>Int16
<td>INT16
<td>1
<tr>
<td>32bit integer
<td>4
<td>Int32
<td>INT32
<td>2
<tr>
<td>64bit integer
<td>8
<td>Int64
<td>INT64
<td>3
<tr>
<td>single precision floating point
<td>4
<td>Float32
<td>FLOAT32
<td>4
<tr>
<td>double precision floating point
<td>8
<td>Float64
<td>FLOAT64
<td>5
<tr>
<td>unsigned byte
<td>1
<td>uChar,uInt8
<td>UCHAR,UINT8
<td>6
<tr>
<td>unsigned short (16 bit) integer
<td>2
<td>uInt16
<td>UINT16
<td>7
<tr>
<td>unsigned 32bit integer
<td>4
<td>uInt32
<td>UINT32
<td>8
<tr>
<td>unsigned 64bit integer
<td>8
<td>uInt64
<td>UINT64
<td>9
<tr>
<td>special byte type for text data <i>(to differentiate it from binary byte data)</i>
<td>1
<td>Char,Char8,String
<td>CHAR,CHAR8,STRING 
<td>10
<tr>
<td>special type for unicode (16bit) text to differentiate from binary 
																		  unsigned integer data
<td>2
<td>Unicode,Char16
<td>UNICODE,CHAR16
<td>11

	</table><p>

      <hr>
      <font face="arial,helvetica" color="#555588"><h2><a name="utils">Utility Subroutines</a></h2></font>
      Various utility subroutines can be used to use the type
      information to compute data array sizes.
      <a name="nbytes"><u><h3>Number of Bytes in a Dataset</h3></u></a>
      <DL>
	<DD>
      <DL>
	<DT><b>C++ Call Format</b>
	<DD><code>int IObase::nBytes(IObase::DataType datatype,int rank,int *dims)</code>
	<DT><b>C Call Format</b>
	<DD><code>int IOnBytes(int datatype,int rank,int *dims)</code>
	<DT><b>F77 Call Format</b>
	<DD> <code>INTEGER IO_NBYTES(INTEGER datatype,INTEGER
	    rank,INTEGER dims(*))</code></DL>
      <hr>
	  <DL>
	    <DT><i>datatype</i>:
	    <DD>The datatype for elements of the array
	    <DT><i>rank</i>:
	    <DD>The number of dimensions of the array
	    <DT><i>dims</i>:
	    <DD>A vector of the dimensions of the array
	    <DT><font color="#885533"><b><i>returns</i></b></font>
	    <DD>Returns the number of bytes required to store the array
	  </DL>
      <hr>
      </DL>

      <a name="nelements"><u><h3>Number of Elements in a Dataset</h3></u></a>
       <DL>
	<DD>
	  <DL>
	<DT><b>C++ Call Format</b>
	<DD><code>int IObase::nElements(int rank,int *dims)</code>
	<DT><b>C Call Format</b>
	<DD><code>int IOnElements(int rank,int *dims)</code>
	<DT><b>F77 Call Format</b>
	<DD> <code>INTEGER IO_NELEMENTS(INTEGER rank,INTEGER dims(*))</code></DL>
	  <hr>
	  <DL>
	    <DT><i>rank</i>:
	    <DD>The number of dimensions of the array
	    <DT><i>dims</i>:
	    <DD>A vector of the dimensions of the array
	    <DT><font color="#885533"><b><i>returns</i></b></font>
	    <DD>Returns the number of elements required in the array
	  </DL>
      <hr>
      </DL>

      <a name="sizeof"><u><h3>Size of a DataType in Bytes</h3></u></a>
       <DL>
	<DD>
	  <DL>
	<DT><b>C++ Call Format</b>
	<DD><code>int IObase::sizeOf(IObase::DataType datatype)</code>
	<DT><b>C Call Format</b>
	<DD><code>int IOsizeOf(int datatype)</code>
	<DT><b>F77 Call Format</b>
	<DD> <code>INTEGER IO_SIZEOF(INTEGER datatype)</code></DL>
      <hr>
	  <DL>
	    <DT><i>datatype</i>:
	    <DD>The datatype for elements of the array.
	    <DT><font color="#885533"><b><i>returns</i></b></font>
	    <DD>Returns the number of bytes used by an element of the
	      specified datatype.
	  </DL>
      <hr>
      </DL>

      <hr>
      <address><a href="mailto:jshalf@ariel.ncsa.uiuc.edu"></a></address>
      <!-- Created: Thu Jan 28 16:35:13 CST 1999 -->
      <!-- hhmts start -->
Last modified: Wed Feb  3 22:02:45 CST 1999
<!-- hhmts end -->
    </body>
</html>