/usr/include/simgear/io/lowlevel.hxx is in libsimgear-dev 3.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | // lowlevel.hxx -- routines to handle lowlevel compressed binary IO of
// various datatypes
//
// Shamelessly adapted from plib January 2001
//
// Original version Copyright (C) 2000 the plib team
// Local changes Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
//
#ifndef _SG_LOWLEVEL_HXX
#define _SG_LOWLEVEL_HXX
#include <stdio.h>
#include <zlib.h>
#include <simgear/compiler.h>
#include <simgear/misc/stdint.hxx>
#include <simgear/math/SGMath.hxx>
// Note that output is written in little endian form (and converted as
// necessary for big endian machines)
void sgReadChar ( gzFile fd, char *var ) ;
void sgWriteChar ( gzFile fd, const char var ) ;
void sgReadFloat ( gzFile fd, float *var ) ;
void sgWriteFloat ( gzFile fd, const float var ) ;
void sgReadDouble ( gzFile fd, double *var ) ;
void sgWriteDouble ( gzFile fd, const double var ) ;
void sgReadUInt ( gzFile fd, unsigned int *var ) ;
void sgWriteUInt ( gzFile fd, const unsigned int var ) ;
void sgReadInt ( gzFile fd, int *var ) ;
void sgWriteInt ( gzFile fd, const int var ) ;
void sgReadLong ( gzFile fd, int32_t *var ) ;
void sgWriteLong ( gzFile fd, const int32_t var ) ;
void sgReadLongLong ( gzFile fd, int64_t *var ) ;
void sgWriteLongLong ( gzFile fd, const int64_t var ) ;
void sgReadUShort ( gzFile fd, unsigned short *var ) ;
void sgWriteUShort ( gzFile fd, const unsigned short var ) ;
void sgReadShort ( gzFile fd, short *var ) ;
void sgWriteShort ( gzFile fd, const short var ) ;
void sgReadFloat ( gzFile fd, const unsigned int n, float *var ) ;
void sgWriteFloat ( gzFile fd, const unsigned int n, const float *var ) ;
void sgReadDouble ( gzFile fd, const unsigned int n, double *var ) ;
void sgWriteDouble ( gzFile fd, const unsigned int n, const double *var ) ;
void sgReadUInt ( gzFile fd, const unsigned int n, unsigned int *var ) ;
void sgWriteUInt ( gzFile fd, const unsigned int n, const unsigned int *var ) ;
void sgReadInt ( gzFile fd, const unsigned int n, int *var ) ;
void sgWriteInt ( gzFile fd, const unsigned int n, const int *var ) ;
void sgReadUShort ( gzFile fd, const unsigned int n, unsigned short *var ) ;
void sgWriteUShort ( gzFile fd, const unsigned int n, const unsigned short *var ) ;
void sgReadShort ( gzFile fd, const unsigned int n, short *var ) ;
void sgWriteShort ( gzFile fd, const unsigned int n, const short *var ) ;
void sgReadBytes ( gzFile fd, const unsigned int n, void *var ) ;
void sgWriteBytes ( gzFile fd, const unsigned int n, const void *var ) ;
void sgReadString ( gzFile fd, char **var ) ;
void sgWriteString ( gzFile fd, const char *var ) ;
inline void sgReadVec2 ( gzFile fd, SGVec2f& var ) {
sgReadFloat ( fd, 2, var.data() ) ;
}
inline void sgWriteVec2 ( gzFile fd, const SGVec2f& var ) {
sgWriteFloat ( fd, 2, var.data() ) ;
}
inline void sgReadVec3 ( gzFile fd, SGVec3f& var ) {
sgReadFloat ( fd, 3, var.data() ) ;
}
inline void sgWriteVec3 ( gzFile fd, const SGVec3f& var ) {
sgWriteFloat ( fd, 3, var.data() ) ;
}
inline void sgReaddVec3 ( gzFile fd, SGVec3d& var ) {
sgReadDouble ( fd, 3, var.data() ) ;
}
inline void sgWritedVec3 ( gzFile fd, const SGVec3d& var ) {
sgWriteDouble ( fd, 3, var.data() ) ;
}
inline void sgReadVec4 ( gzFile fd, SGVec4f& var ) {
sgReadFloat ( fd, 4, var.data() ) ;
}
inline void sgWriteVec4 ( gzFile fd, const SGVec4f& var ) {
sgWriteFloat ( fd, 4, var.data() ) ;
}
inline void sgReadMat4 ( gzFile fd, SGMatrixf& var ) {
sgReadFloat ( fd, 16, (float *)var.data() ) ;
}
inline void sgWriteMat4 ( gzFile fd, const SGMatrixf& var ) {
sgWriteFloat ( fd, 16, (float *)var.data() ) ;
}
inline void sgReadGeod ( gzFile fd, SGGeod& var ) {
double data[3];
sgReadDouble ( fd, 3, data );
var = SGGeod::fromDegM( data[0], data[1], data[2] );
}
inline void sgWriteGeod ( gzFile fd, const SGGeod& var ) {
sgWriteDouble( fd, var.getLongitudeDeg() );
sgWriteDouble( fd, var.getLatitudeDeg() );
sgWriteDouble( fd, var.getElevationM() );
}
void sgClearReadError();
void sgClearWriteError();
int sgReadError();
int sgWriteError();
#endif // _SG_LOWLEVEL_HXX
|