TF++, Miscellaneous classes and modules in C++:

All facilities for checking bytesex and swapping input binary data. ,. More...

Classes

union  IOUnion
 

Enumerations

enum  Ecpu_type { cpu_Intel = 1, cpu_Motorola = 2, cpu_unknown = 3 }
 Define different CPU type that are recognized. More...
 
enum  Emagic_type { magic_match = 1, magic_swap = 2, magic_nomatch = 3 }
 Define bytesex indicator for magic number test. More...
 

Functions

template<class T >
swap (const T &value)
 How to swap any generic type. More...
 
template<class T >
IOUnion< T > swap (const IOUnion< T > &value)
 Specialization in case we use use an IOUnion. i.e. overloading the function. More...
 
int magic (const char *const cmagic)
 Create a magic number from a character string. ,If $x_{i}=(\vec{x})_{i}$ represents the input character sequence cmagic and $N=4$ is the value of sizeof(int), then the return value will be

\[ \textrm{magic}(\vec{x}) =\sum\limits_{i=0}^{N-1} x_{i}\; 2^{8\; (N-1-i)} =x_{3}+256\; (x_{2}+256\; (x_{1}+256\; x_{0})). \]

. More...

 
Ecpu_type cpu ()
 Check CPU model. ,. More...
 
Emagic_type file_magic_test (std::istream &is, const char *const cmagic, const bool &fortranmode=false)
 Check for magic number in file. More...
 
void file_magic_write (std::ostream &os, const char *const cmagic, const bool &fortranmode=false)
 Write magic number to file. ,. More...
 

Detailed Description

All facilities for checking bytesex and swapping input binary data. ,.

Since
November 2002
See also
TEST: Fortran I/O and byte swapping.