Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages Examples
binary data format draft 0.1 and note
The project page is http://dataio.sourceforge.net/.
More...
-
See also:
-
data format draft 0.1 and note, dataio
-
Note:
-
supported primitive data type
The supported primitive data type are:
bool, char, wchar_t (wchat_t does not work?), string, int, long, unsigned, unsigned long, float, double, long double.
To add new primitive type T, specialize the following two template methods:
bool _dataiorec<T>::readitem(istream &is, T &iten); void _dataiorec<T>::writeitem(ostream &os, T const &item);
If T is supported primitive type (that above two methods is epecialized) vector <T> and vector<vector<T> > are automatically supported.
The named and unnamed data is undistinguiched, and input/putput follows the added order.
-
primitive type binary formats:
-
- string is treated as ASC Z string (null terminates sequence of chars) and write '\0' at end of string.
- The followings data assume to more significant to less significant byte order. is reversebyteorder is actived, the byte is less significant more significant. The numerical binary format use the IEEE 754 binary standard:
- wchar_t (2 bytes): it is not IEEE 754 standard.
- int, unsigned (4 bytes)
- long, unsigned long (8 bytes)
- long long, unsigned long long (usa same as long and unsigned long): it is not the IEEE 754 standard
- float (4 bytes - 32 bits): single precision float.
- 8 bits for expoent in biased representation: expoent value = expoent - 127.
- 32 - 8 bits for fraction part (first bit is sign).
- the value is [fraction part]*2^[expoent value]
- double (8 bytes - 64 bits): double precision:
- 11 bit for expoent in biased representation: expoent value = expoent - 1023.
- 64 - 11 bits for fraction part (first bit is sign sign).
- the value is [fraction part]*2^[expoent value]
- long double (use same as double): Not the IEEE standard.
To process floating point binary format, useds following ANSU C functions: double frexp(double val, *n) to obtain expoent and fraction part: x = frexp(y,n) call set the values so that y = x*2^n (0 <= x < 1)
double ldexp(double val, *n) to restore value using expoent and fraction part y = ldexp(x,n) calling set the values so that y = x*2^n (0 <= x < 1)
- to think: implement size() that return size used by record
- to think: multi-block features in the first level record data
Generated at Thu Sep 6 13:45:43 2001 for dataio by
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001