Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
frameRoutines.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file frameRoutines.C
1
/*
2
** frameRoutines.C
3
**
4
** Author: $Author: purschke $
5
** Date: $Date: 2000/07/21 01:51:13 $
6
**
7
** $Log: frameRoutines.C,v $
8
** Revision 1.1.1.1 2000/07/21 01:51:13 purschke
9
** mlp -- adding the new automakified "basic" module to CVS.
10
**
11
**
12
** Revision 1.4 1999/10/07 19:53:35 steinber
13
** changed storeFrameHistory to not use padding. breaks EvB code otherwise
14
**
15
** Revision 1.3 1998/12/11 22:02:05 markacs
16
** (stephen markacs) adding log into cvs tags
17
**
18
*/
19
/*
20
** makeFrameHdr
21
**
22
** Routine to make a new frame header in a buffer pointed
23
** to by "newFramePtr". The header is created with "empty"
24
** data, history, and error blocks.
25
*/
26
27
#include "
phenixOnline.h
"
28
#include "
frameRoutines.h
"
29
#include "
framePublic.h
"
30
#include "
Cframe.h
"
31
32
/*
33
** storeFrameData
34
**
35
** Routine to store data in new frame.
36
**
37
*/
38
VALUE_ret
storeFrameData
(
PHDWORD
* frame_ptr,
UINT
maxFrameLen,
39
PHDWORD
* frameData,
UINT
dataDwords)
40
{
41
PHDWORD
* output_ptr;
42
UINT
finalLength;
43
44
/*
45
** Make sure we're pointing to a real frame and
46
** that the header version is the current one
47
** (we don't write old frame headers)
48
*/
49
if
(
currentFrameHdr
(frame_ptr))
50
return
valueFailure
;
51
52
/*
53
** Only store data in empty frames
54
*/
55
if
(!
emptyFrame
(frame_ptr))
return
valueFailure
;
56
57
/*
58
** Strip off any padding in the frame
59
*/
60
removeFramePadding
(frame_ptr);
61
62
/*
63
** Find out where to write data
64
*/
65
output_ptr =
findFrameDataStart
(frame_ptr);
66
if
(output_ptr ==
ptrFailure
)
67
return
valueFailure
;
68
69
/*
70
** Now extend the frame to hold the data
71
*/
72
finalLength =
extendFrameData
(frame_ptr, maxFrameLen, dataDwords);
73
if
(finalLength ==
valueFailure
)
74
return
valueFailure
;
75
76
/*
77
** Now transfer the data into the frame.
78
*/
79
dwordCopy
(output_ptr, frameData, dataDwords);
80
81
return
finalLength;
82
}
83
84
/*
85
** Store a history block in a frame that doesn't already have one
86
*/
87
VALUE_ret
storeFrameHistory
(
PHDWORD
* frame_ptr,
UINT
maxFrameLen,
88
PHDWORD
* frameHistory,
UINT
historyDwords)
89
{
90
PHDWORD
* history_ptr;
91
UINT
finalLength;
92
93
/*
94
** Make sure we're pointing to a real frame and
95
** that the header version is the current one
96
** (we don't write old frame headers)
97
*/
98
if
(!
validFrameHdr
(frame_ptr) || !
currentFrameHdr
(frame_ptr))
99
return
valueFailure
;
100
101
/*
102
** Only store history in empty history block
103
*/
104
if
(
getFrameHistoryLength
(frame_ptr) != 0)
return
valueFailure
;
105
106
/*
107
** Strip off any frame padding
108
*/
109
removeFramePadding
(frame_ptr);
110
111
/*
112
** Get pointer to history block
113
*/
114
history_ptr =
findFrameHistoryStart
(frame_ptr);
115
if
(history_ptr ==
ptrFailure
)
116
return
valueFailure
;
117
118
/*
119
** Extend the frame to hold the history data
120
*/
121
finalLength =
extendFrameHistoryNopad
(frame_ptr, maxFrameLen, historyDwords);
122
if
( finalLength ==
valueFailure
)
123
return
valueFailure
;
124
125
/*
126
** Now copy in history words
127
*/
128
dwordCopy
(history_ptr, frameHistory, historyDwords);
129
130
return
finalLength;
131
}
132
133
/*
134
** Extend the length of the data block in a frame
135
*/
136
VALUE_ret
extendFrameData
(
FRAME_ptr
frame_ptr,
UINT
maxFrameLength,
UINT
dataDwords)
137
{
138
if
(
adjustFrameDataLength
(frame_ptr, dataDwords) !=
valueFailure
) {
139
/*
140
** We only need to extend the length of the frame.
141
*/
142
return
adjustFrameLength
(frame_ptr, maxFrameLength, dataDwords,
TRUE
);
143
}
144
else
return
valueFailure
;
145
}
146
147
/*
148
** Extend the length of the data block in a frame
149
*/
150
VALUE_ret
extendFrameDataNopad
(
FRAME_ptr
frame_ptr,
UINT
maxFrameLength,
UINT
dataDwords)
151
{
152
if
(
adjustFrameDataLength
(frame_ptr, dataDwords) !=
valueFailure
) {
153
/*
154
** We only need to extend the length of the frame.
155
*/
156
return
adjustFrameLength
(frame_ptr, maxFrameLength, dataDwords,
FALSE
);
157
}
158
else
return
valueFailure
;
159
}
160
161
162
/*
163
** Extend the length of the history block in a frame
164
*/
165
VALUE_ret
extendFrameHistory
(
FRAME_ptr
frame_ptr,
UINT
maxFrameLength,
UINT
historyDwords)
166
{
167
if
(
adjustFrameHistoryLength
(frame_ptr, historyDwords) !=
valueFailure
) {
168
/*
169
** We only need to extend the length of the frame.
170
*/
171
return
adjustFrameLength
(frame_ptr, maxFrameLength, historyDwords,
TRUE
);
172
}
173
else
return
valueFailure
;
174
}
175
176
/*
177
** Extend the length of the history block in a frame
178
*/
179
VALUE_ret
extendFrameHistoryNopad
(
FRAME_ptr
frame_ptr,
UINT
maxFrameLength,
UINT
historyDwords)
180
{
181
if
(
adjustFrameHistoryLength
(frame_ptr, historyDwords) !=
valueFailure
) {
182
/*
183
** We only need to extend the length of the frame.
184
*/
185
return
adjustFrameLength
(frame_ptr, maxFrameLength, historyDwords,
FALSE
);
186
}
187
else
return
valueFailure
;
188
}
189
190
191
192
193
194
195
196
197
198
online_distribution
blob
master
newbasic
frameRoutines.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:27
using
1.8.2 with
sPHENIX GitHub integration