-
Notifications
You must be signed in to change notification settings - Fork 3
/
OROrcaRequestDecoder.cc
79 lines (62 loc) · 2.48 KB
/
OROrcaRequestDecoder.cc
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
// OROrcaRequestDecoder.cc
#include "OROrcaRequestDecoder.hh"
#include "ORLogger.hh"
#include "ORUtils.hh"
//**************************************************************************************
OROrcaRequestDecoder::OROrcaRequestDecoder() { fDataRecord = NULL; }
bool OROrcaRequestDecoder::ParseDataRecord(UInt_t* dataRecord)
{
fDataRecord = dataRecord;
ORLog(kDebug) << "ParseDataRecord(): Parsing the data record..." << std::endl;
if (LengthOf(fDataRecord) - kBufferLength <=0) {
ORLog(kWarning) << "Record length of 0." << std::endl;
return false;
}
if (!fXMLRecord.LoadXmlPlist((char*) (fDataRecord + kBufferLength),
sizeof(UInt_t)*(LengthOf(fDataRecord)-kBufferLength))) {
ORLog(kError) << "Error parsing data record..." << std::endl;
return false;
}
/* Getting XML Values */
// Getting Tag Number
ORLog(kDebug) << "ParseDataRecord(): Getting the Request Tag Number..." << std::endl;
const ORDictValueI* reqTagPtr =
dynamic_cast<const ORDictValueI*>(fXMLRecord.LookUp("Request Tag Number"));
if(!reqTagPtr) {
ORLog(kError) << "Error getting Request Tag Number. " << std::endl;
return false;
}
fRequestTagNumber = reqTagPtr->GetI();
// Getting Request Type
ORLog(kDebug) << "ParseDataRecord(): Getting the Request Type..." << std::endl;
const ORDictValueS* reqTypePtr =
dynamic_cast<const ORDictValueS*>(fXMLRecord.LookUp("Request Type"));
if(!reqTypePtr) {
ORLog(kError) << "Error getting Request Type. " << std::endl;
return false;
}
fRequestType = reqTypePtr->GetS();
// Getting Request Option
ORLog(kDebug) << "ParseDataRecord(): Getting the Request Option..." << std::endl;
const ORDictValueS* reqOptionPtr =
dynamic_cast<const ORDictValueS*>(fXMLRecord.LookUp("Request Option"));
if(!reqOptionPtr) {
ORLog(kError) << "Error getting Request Option. " << std::endl;
return false;
}
fRequestOption = reqOptionPtr->GetS();
// Getting Inputs
ORLog(kDebug) << "ParseDataRecord(): Getting the Request Inputs..." << std::endl;
fRequestInputs = dynamic_cast<const ORDictionary*>(fXMLRecord.LookUp("Request Inputs"));
if(!fRequestInputs) {
ORLog(kError) << "Error getting Request Inputs. " << std::endl;
return false;
}
ORLog(kDebug) << "ParseDataRecord(): Exiting" << std::endl;
return true;
}
//debugging: *************************************************************************
void OROrcaRequestDecoder::Dump(UInt_t*) //debugging
{
//eventually something will be here
}