1
/*******************************************************************************
3
* mcf_StdHep_cxx.c -- XDR Utility routines for the Block Stdhep filters *
5
* Copyright (c) 1994 Universities Research Association, Inc. *
6
* All rights reserved. *
8
* This material resulted from work developed under a Government Contract and *
9
* is subject to the following license: The Government retains a paid-up, *
10
* nonexclusive, irrevocable worldwide license to reproduce, prepare derivative *
11
* works, perform publicly and display publicly by or for the Government, *
12
* including the right to distribute to other Government contractors. Neither *
13
* the United States nor the United States Department of Energy, nor any of *
14
* their employees, makes any warranty, express or implied, or assumes any *
15
* legal liability or responsibility for the accuracy, completeness, or *
16
* usefulness of any information, apparatus, product, or process disclosed, or *
17
* represents that its use would not infringe privately owned rights. *
20
* Written by Lynn Garren *
23
*******************************************************************************/
26
#include <sys/param.h>
27
#include <rpc/types.h>
28
#include <sys/types.h>
32
#include <floatingpoint.h>
38
#include "mcfio_Dict.h"
49
struct stdver stdver_;
51
bool_t xdr_stdhep_cxx_(XDR *xdrs, int *blockid,
52
int *ntot, char** version)
55
/* Translate a copy of the StdHep::Event class to/from
56
an XDR stream. Note that we do not allocate memory, because we fill
57
directly the COMMON. Also, mcfio will allocate the space for the
60
unsigned int nn, nnint, nndbl, nnw, nnw4, nnw5, nmlt, nnmlt;
65
if ((xdrs->x_op == XDR_ENCODE) || (xdrs->x_op == XDR_MCFIOCODE)) {
66
if (*blockid != MCFIO_STDHEPCXX) {
67
fprintf (stderr, "mcf_StdHep_cxx: Inconsistent Blockid %d \n ",
71
nnint = 8 * sizeof(int) * stdevent_.nhep;
72
nndbl = 16 * sizeof(double) * stdevent_.nhep;
73
nmlt = 3 * sizeof(int) * stdevent_.ncol;
74
nnw = (unsigned int) stdevent_.nhep;
76
nnmlt = (unsigned int) stdevent_.ncol;
77
*ntot = 6 * sizeof(int) + nnint + nndbl + nmlt;
78
if (xdrs->x_op == XDR_MCFIOCODE) return TRUE;
79
strncpy(version[0],stdver_.stdhep_ver, 4);
82
if ( (xdr_int(xdrs, blockid) &&
83
xdr_int(xdrs, ntot) &&
84
xdr_string(xdrs, version, MCF_XDR_VERSION_LENGTH) &&
85
xdr_int(xdrs, &(stdevent_.nevhep)) &&
86
xdr_int(xdrs, &(stdevent_.nhep)) &&
87
xdr_int(xdrs, &(stdevent_.ncol))) == FALSE) return FALSE;
89
if ((xdrs->x_op == XDR_DECODE) && ( *blockid != MCFIO_STDHEPCXX) ) {
90
fprintf (stderr, "mcf_StdHep_cxx: Inconsistent Blockid %d \n ",
94
idat = stdevent_.nevcol;
95
if ( xdr_array(xdrs, (char **) &idat,
96
&nnmlt, NMXMLT, sizeof(int), xdr_int) == FALSE) return FALSE;
97
idat = stdevent_.iostr;
98
if ( xdr_array(xdrs, (char **) &idat,
99
&nnmlt, NMXMLT, sizeof(int), xdr_int) == FALSE) return FALSE;
100
idat = stdevent_.nhepcol;
101
if ( xdr_array(xdrs, (char **) &idat,
102
&nnmlt, NMXMLT, sizeof(int), xdr_int) == FALSE) return FALSE;
103
idat = stdevent_.isthep;
104
if ( xdr_array(xdrs, (char **) &idat,
105
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
106
idat = stdevent_.idhep;
107
if ( xdr_array(xdrs, (char **) &idat,
108
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
109
idat = stdevent_.jmohep1;
110
if ( xdr_array(xdrs, (char **) &idat,
111
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
112
idat = stdevent_.jmohep2;
113
if ( xdr_array(xdrs, (char **) &idat,
114
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
115
idat = stdevent_.jdahep1;
116
if ( xdr_array(xdrs, (char **) &idat,
117
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
118
idat = stdevent_.jdahep2;
119
if ( xdr_array(xdrs, (char **) &idat,
120
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
121
idat = stdevent_.color;
122
if ( xdr_array(xdrs, (char **) &idat,
123
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
124
idat = stdevent_.jcol;
125
if ( xdr_array(xdrs, (char **) &idat,
126
&nnw, NMXHEP, sizeof(int), xdr_int) == FALSE) return FALSE;
127
dat = (double *) stdevent_.phep;
128
if ( xdr_array(xdrs, (char **) &dat,
129
&nnw4, 4*NMXHEP, sizeof(double), xdr_double) == FALSE) return FALSE;
130
dat = stdevent_.mass;
131
if ( xdr_array(xdrs, (char **) &dat,
132
&nnw, NMXHEP, sizeof(double), xdr_double) == FALSE) return FALSE;
133
dat = stdevent_.helicity;
134
if ( xdr_array(xdrs, (char **) &dat,
135
&nnw, NMXHEP, sizeof(double), xdr_double) == FALSE) return FALSE;
136
dat = (double *) stdevent_.vcr;
137
if ( xdr_array(xdrs, (char **) &dat,
138
&nnw4, 4*NMXHEP, sizeof(double), xdr_double) == FALSE) return FALSE;
139
dat = (double *) stdevent_.vdcy;
140
if ( xdr_array(xdrs, (char **) &dat,
141
&nnw4, 4*NMXHEP, sizeof(double), xdr_double) == FALSE) return FALSE;
142
if ( xdr_int(xdrs, &(stdevent_.ncol)) == FALSE) return FALSE;