Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
xdrfile.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include "xdrfile.h"

Classes

struct  PLMD::xdrfile::XDR
 
struct  PLMD::xdrfile::XDR::xdr_ops
 
struct  PLMD::xdrfile::XDRFILE
 Contents of the abstract XDRFILE data structure. More...
 

Namespaces

 PLMD
 
 PLMD::xdrfile
 

Macros

#define _FILE_OFFSET_BITS   64
 
#define BYTES_PER_XDR_UNIT   4
 
#define F77_FUNC(name, NAME)   name ## _
 
#define FIRSTIDX   9
 
#define LASTIDX   (sizeof(magicints) / sizeof(*magicints))
 
#define MAX_FORTRAN_XDR   1024
 
#define xdr_destroy(xdrs)
 
#define xdr_getbytes(xdrs, addr, len)   (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
 
#define xdr_getlong(xdrs, longp)   (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
 
#define xdr_getpos(xdrs)   (*(xdrs)->x_ops->x_getpostn)(xdrs)
 
#define xdr_putbytes(xdrs, addr, len)   (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
 
#define xdr_putlong(xdrs, longp)   (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
 
#define xdr_setpos(xdrs, pos)   (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
 

Typedefs

typedef struct XDR PLMD::xdrfile::XDR
 
typedef int(* PLMD::xdrfile::xdrproc_t) (XDR *, void *,...)
 

Enumerations

enum  PLMD::xdrfile::xdr_op { PLMD::xdrfile::XDR_ENCODE = 0, PLMD::xdrfile::XDR_DECODE = 1, PLMD::xdrfile::XDR_FREE = 2 }
 

Functions

static int PLMD::xdrfile::ctofstr (char *dest, int dest_len, char *src)
 
 PLMD::xdrfile::ctofstr (str, len, cstr)
 
static int PLMD::xdrfile::decodebits (int buf[], int num_of_bits)
 
static void PLMD::xdrfile::decodeints (int buf[], int num_of_ints, int num_of_bits, unsigned int sizes[], int nums[])
 
static void PLMD::xdrfile::encodebits (int buf[], int num_of_bits, int num)
 
static void PLMD::xdrfile::encodeints (int buf[], int num_of_ints, int num_of_bits, unsigned int sizes[], unsigned int nums[])
 
void PLMD::xdrfile::F77_FUNC (xddcd, XDRDCD)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrccd, XDRCCD)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrccs, XDRCCS)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrclose, XDRCLOSE)(int *fid)
 
void PLMD::xdrfile::F77_FUNC (xdrdcs, XDRDCS)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdropen, XDROPEN)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrchar, XDRRCHAR)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrdouble, XDRRDOUBLE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrint, XDRRINT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrropaque, XDRROPAQUE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrshort, XDRRSHORT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrsingle, XDRRSINGLE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrstring, XDRRSTRING)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrruchar, XDRRUCHAR)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrruint, XDRRUINT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrrushort, XDRRUSHORT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwchar, XDRWCHAR)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwdouble, XDRWDOUBLE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwint, XDRWINT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwopaque, XDRWOPAQUE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwshort, XDRWSHORT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwsingle, XDRWSINGLE)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwstring, XDRWSTRING)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwuchar, XDRWUCHAR)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwuint, XDRWUINT)(int *fid
 
void PLMD::xdrfile::F77_FUNC (xdrwushort, XDRWUSHORT)(int *fid
 
 PLMD::xdrfile::free (cstr)
 
static int PLMD::xdrfile::ftocstr (char *dest, int dest_len, char *src, int src_len)
 
 PLMD::xdrfile::if ((cstr=(char *) malloc((len+1) *sizeof(char)))==NULL)
 
 PLMD::xdrfile::if (f77init)
 
else PLMD::xdrfile::if (ftocstr(cfilename, sizeof(cfilename), filename, fn_len))
 
else PLMD::xdrfile::if (ftocstr(cmode, sizeof(cmode), mode, mode_len))
 
 PLMD::xdrfile::if (ftocstr(cstr, len+1, str, len))
 
 PLMD::xdrfile::if (i==MAX_FORTRAN_XDR)
 
static int PLMD::xdrfile::sizeofint (int size)
 
static int PLMD::xdrfile::sizeofints (int num_of_ints, unsigned int sizes[])
 
 PLMD::xdrfile::while (i< MAX_FORTRAN_XDR &&f77xdr[i]!=NULL) i++
 
static int PLMD::xdrfile::xdr_char (XDR *xdrs, char *ip)
 
static int PLMD::xdrfile::xdr_double (XDR *xdrs, double *ip)
 
static int PLMD::xdrfile::xdr_float (XDR *xdrs, float *ip)
 
static int32_t PLMD::xdrfile::xdr_htonl (int32_t x)
 
static int PLMD::xdrfile::xdr_int (XDR *xdrs, int *ip)
 
static int32_t PLMD::xdrfile::xdr_ntohl (int x)
 
static int PLMD::xdrfile::xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt)
 
static int PLMD::xdrfile::xdr_short (XDR *xdrs, short *ip)
 
static int PLMD::xdrfile::xdr_string (XDR *xdrs, char **ip, unsigned int maxsize)
 
static int32_t PLMD::xdrfile::xdr_swapbytes (int32_t x)
 
static int PLMD::xdrfile::xdr_u_char (XDR *xdrs, unsigned char *ip)
 
static int PLMD::xdrfile::xdr_u_int (XDR *xdrs, unsigned int *ip)
 
static int PLMD::xdrfile::xdr_u_short (XDR *xdrs, unsigned short *ip)
 
int PLMD::xdrfile::xdrfile_close (XDRFILE *xfp)
 Close a previously opened portable binary file, just like fclose() More...
 
int PLMD::xdrfile::xdrfile_compress_coord_double (double *ptr, int ncoord, double precision, XDRFILE *xfp)
 Compress coordiates in a double array to XDR file. More...
 
int PLMD::xdrfile::xdrfile_compress_coord_float (float *ptr, int ncoord, float precision, XDRFILE *xfp)
 Compress coordiates in a float array to XDR file. More...
 
int PLMD::xdrfile::xdrfile_decompress_coord_double (double *ptr, int *ncoord, double *precision, XDRFILE *xfp)
 Decompress coordiates from XDR file to array of doubles. More...
 
int PLMD::xdrfile::xdrfile_decompress_coord_float (float *ptr, int *ncoord, float *precision, XDRFILE *xfp)
 Decompress coordiates from XDR file to array of floats. More...
 
XDRFILE * PLMD::xdrfile::xdrfile_open (const char *path, const char *mode)
 Open a portable binary file, just like fopen() More...
 
int PLMD::xdrfile::xdrfile_read_char (char *ptr, int ndata, XDRFILE *xfp)
 Read one or more char type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_double (double *ptr, int ndata, XDRFILE *xfp)
 Read one or more double type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_float (float *ptr, int ndata, XDRFILE *xfp)
 Read one or more float type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_int (int *ptr, int ndata, XDRFILE *xfp)
 Read one or more integer type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_opaque (char *ptr, int nbytes, XDRFILE *xfp)
 Read raw bytes from file (unknown datatype) More...
 
int PLMD::xdrfile::xdrfile_read_short (short *ptr, int ndata, XDRFILE *xfp)
 Read one or more short type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_string (char *ptr, int maxlen, XDRFILE *xfp)
 Read a string (array of characters) More...
 
int PLMD::xdrfile::xdrfile_read_uchar (unsigned char *ptr, int ndata, XDRFILE *xfp)
 Read one or more unsigned char type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_uint (unsigned int *ptr, int ndata, XDRFILE *xfp)
 Read one or more unsigned integers type variable(s) More...
 
int PLMD::xdrfile::xdrfile_read_ushort (unsigned short *ptr, int ndata, XDRFILE *xfp)
 Read one or more unsigned short type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_char (char *ptr, int ndata, XDRFILE *xfp)
 Write one or more characters type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_double (double *ptr, int ndata, XDRFILE *xfp)
 Write one or more double type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_float (float *ptr, int ndata, XDRFILE *xfp)
 Write one or more float type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_int (int *ptr, int ndata, XDRFILE *xfp)
 Write one or more integer type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_opaque (char *ptr, int nbytes, XDRFILE *xfp)
 Write raw bytes to file (unknown datatype) More...
 
int PLMD::xdrfile::xdrfile_write_short (short *ptr, int ndata, XDRFILE *xfp)
 Write one or more short type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_string (char *ptr, XDRFILE *xfp)
 Write a string (array of characters) More...
 
int PLMD::xdrfile::xdrfile_write_uchar (unsigned char *ptr, int ndata, XDRFILE *xfp)
 Write one or more unsigned characters type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_uint (unsigned int *ptr, int ndata, XDRFILE *xfp)
 Write one or more unsigned integer type variable(s) More...
 
int PLMD::xdrfile::xdrfile_write_ushort (unsigned short *ptr, int ndata, XDRFILE *xfp)
 Write one or more unsigned short type variable(s) More...
 
static void PLMD::xdrfile::xdrstdio_create (XDR *xdrs, FILE *fp, enum xdr_op xop)
 
static void PLMD::xdrfile::xdrstdio_destroy (XDR *)
 
static int PLMD::xdrfile::xdrstdio_getbytes (XDR *, char *, unsigned int)
 
static int PLMD::xdrfile::xdrstdio_getlong (XDR *, int32_t *)
 
static unsigned int PLMD::xdrfile::xdrstdio_getpos (XDR *)
 
static int PLMD::xdrfile::xdrstdio_putbytes (XDR *, char *, unsigned int)
 
static int PLMD::xdrfile::xdrstdio_putlong (XDR *, int32_t *)
 
static int PLMD::xdrfile::xdrstdio_setpos (XDR *, unsigned int)
 

Variables

char PLMD::xdrfile::cmode [5]
 
void int * PLMD::xdrfile::data
 
 PLMD::xdrfile::else
 
const char * PLMD::xdrfile::exdr_message [exdrNR]
 
static int PLMD::xdrfile::f77init = 1
 
static XDRFILE * PLMD::xdrfile::f77xdr [MAX_FORTRAN_XDR]
 
PLMD::xdrfile::fid =i
 
void char * PLMD::xdrfile::filename
 
void char char int PLMD::xdrfile::fn_len
 
int PLMD::xdrfile::i =0
 
void char * PLMD::xdrfile::ip
 
void char int int PLMD::xdrfile::len
 
static const int PLMD::xdrfile::magicints []
 
void char char * PLMD::xdrfile::mode
 
void char char int int PLMD::xdrfile::mode_len
 
void float int * PLMD::xdrfile::ncoord
 
void int int * PLMD::xdrfile::ndata
 
void float int float * PLMD::xdrfile::precision
 
void int int int * PLMD::xdrfile::ret
 
void char * PLMD::xdrfile::str
 
static char PLMD::xdrfile::xdr_zero [BYTES_PER_XDR_UNIT] = {0, 0, 0, 0}
 
static const XDR::xdr_ops PLMD::xdrfile::xdrstdio_ops
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

◆ BYTES_PER_XDR_UNIT

#define BYTES_PER_XDR_UNIT   4

◆ F77_FUNC

#define F77_FUNC (   name,
  NAME 
)    name ## _

◆ FIRSTIDX

#define FIRSTIDX   9

◆ LASTIDX

#define LASTIDX   (sizeof(magicints) / sizeof(*magicints))

◆ MAX_FORTRAN_XDR

#define MAX_FORTRAN_XDR   1024

◆ xdr_destroy

#define xdr_destroy (   xdrs)
Value:
do { \
if ((xdrs)->x_ops->x_destroy) \
(*(xdrs)->x_ops->x_destroy)(xdrs); \
} while (0)

◆ xdr_getbytes

#define xdr_getbytes (   xdrs,
  addr,
  len 
)    (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)

◆ xdr_getlong

#define xdr_getlong (   xdrs,
  longp 
)    (*(xdrs)->x_ops->x_getlong)(xdrs, longp)

◆ xdr_getpos

#define xdr_getpos (   xdrs)    (*(xdrs)->x_ops->x_getpostn)(xdrs)

◆ xdr_putbytes

#define xdr_putbytes (   xdrs,
  addr,
  len 
)    (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)

◆ xdr_putlong

#define xdr_putlong (   xdrs,
  longp 
)    (*(xdrs)->x_ops->x_putlong)(xdrs, longp)

◆ xdr_setpos

#define xdr_setpos (   xdrs,
  pos 
)    (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)