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
formatError.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file formatError.C
1
/*
2
** formatError.C
3
**
4
** Author: $Author: purschke $
5
** Date: $Date: 2000/07/21 01:51:13 $
6
**
7
** $Log: formatError.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.3 1998/12/11 22:02:02 markacs
13
** (stephen markacs) adding log into cvs tags
14
**
15
*/
16
/*
17
** formatError.C
18
**
19
** Contains error-handling routines for "raw format" library
20
*/
21
22
#include "
formatError.h
"
23
24
/*
25
** For now the error data will be kept in a statically
26
** allocated structure. The actual allocation is done here.
27
*/
28
#define ERROR_PACKAGE_RAWFMT 1
29
30
typedef
struct
formatError
{
31
UINT
subType
;
32
ERRORVALUE
errorNumber
;
33
34
PHDWORD
*
frameOrPacket_ptr
;
35
PHDWORD
additionalData
;
36
}
FORMATERROR
;
37
38
FORMATERROR
rawfmtLastError
;
39
40
/*
41
** Set an error status from a "frame" routine
42
*/
43
void
setFrameError
(
ERRORVALUE
errorNumber,
PHDWORD
* pointer,
PHDWORD
additionalData) {
44
rawfmtLastError.
subType
=
errorTypeFrame
;
45
rawfmtLastError.
errorNumber
= errorNumber ;
46
rawfmtLastError.
frameOrPacket_ptr
= pointer;
47
rawfmtLastError.
additionalData
= additionalData;
48
}
49
50
/*
51
** Set an error status from a "packet" routine
52
*/
53
void
setPacketError
(
ERRORVALUE
errorNumber,
PHDWORD
* pointer,
PHDWORD
additionalData) {
54
rawfmtLastError.
subType
=
errorTypePacket
;
55
rawfmtLastError.
errorNumber
= errorNumber;
56
rawfmtLastError.
frameOrPacket_ptr
= pointer;
57
rawfmtLastError.
additionalData
= additionalData;
58
}
59
60
/*
61
** Set a "user" error status
62
*/
63
void
setUserError
(
ERRORVALUE
errorNumber,
PHDWORD
additionalData) {
64
rawfmtLastError.
subType
=
errorTypeUser
;
65
rawfmtLastError.
errorNumber
= errorNumber;
66
rawfmtLastError.
additionalData
= additionalData;
67
}
68
69
/*
70
** Set success status for a "frame" routine.
71
*/
72
void
setFrameSuccess
() {
73
rawfmtLastError.
errorNumber
= 0;
74
}
75
76
/*
77
** Set success for a "packet" routine.
78
*/
79
void
setPacketSuccess
() {
80
rawfmtLastError.
errorNumber
= 0;
81
}
82
83
/*
84
// Returns the error code for the "last" recorded error
85
*/
86
ERRORVALUE
formatGetErrorNumber
( ) {
87
return
rawfmtLastError.
errorNumber
;
88
}
89
90
/*
91
** Returns the error number and unpacks error data for the last recorded error
92
*/
93
ERRORVALUE
formatGetError
(
UINT
* subType,
PHDWORD
** errorPointer,
PHDWORD
* additionalData) {
94
*subType = rawfmtLastError.
subType
;
95
*errorPointer = rawfmtLastError.
frameOrPacket_ptr
;
96
*additionalData = rawfmtLastError.
additionalData
;
97
98
return
rawfmtLastError.
errorNumber
;
99
}
100
101
/*
102
** Returns the pointer to the last failed frame or packet
103
*/
104
PHDWORD
*
formatGetErrorPointer
() {
105
if
(rawfmtLastError.
errorNumber
== 0)
106
return
0;
107
else
108
return
rawfmtLastError.
frameOrPacket_ptr
;
109
}
110
111
/*
112
** Returns additional data about the last error
113
*/
114
PHDWORD
formatGetErrorAdditionalData
() {
115
if
(rawfmtLastError.
errorNumber
== 0)
116
return
0;
117
else
118
return
rawfmtLastError.
additionalData
;
119
}
online_distribution
blob
master
newbasic
formatError.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:27
using
1.8.2 with
sPHENIX GitHub integration