-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCV977Unpacker.cpp
69 lines (57 loc) · 1.75 KB
/
CV977Unpacker.cpp
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
/*
This software is Copyright by the Board of Trustees of Michigan
State University (c) Copyright 2005.
You may use this software under the terms of the GNU public license
(GPL). The terms of this license are described at:
http://www.gnu.org/licenses/gpl.txt
Author:
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
*/
#include <config.h>
#include "CV977Unpacker.h"
#include <Event.h>
#include <stdint.h>
using namespace std;
///////////////////////////////////////////////////////////////////////////
// Canonicals
/*!
Construction is a no-op.
*/
CV977Unpacker::CV977Unpacker()
{}
/*!
Destruction is a no-op.
*/
CV977Unpacker::~CV977Unpacker()
{}
////////////////////////////////////////////////////////////////////////
// Virtual function overrides.
/*!
Perform the unpack. The module unconditionally adds a single
16 bit word to the data stream.
@param rEvent - The event we are unpacking into.
@param event - Vector containing the raw data for this event from the VM-USB
@param offset - Index into the event vector at which we'll find the
next parameter.
@param pMap - Pointer to our parameter map. This contains the map
that tells us which element of rEvent to stuff.
@return unsigned int
@retval offset to the first word of the event not processed by us.
*/
unsigned int
CV977Unpacker::operator()(CEvent& rEvent,
vector<unsigned short>& event,
unsigned int offset,
CParamMapCommand::AdcMapping* pMap)
{
uint16_t datum = event[offset];
int id = pMap->map[0];
if (id != -1) {
rEvent[id] = datum;
}
offset += 1;
return offset;
}