All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | List of all members
sbn::MWRData Class Reference

#include <MWRData.h>

Classes

struct  mwrpulse_t
 
struct  swicheader_t
 

Public Member Functions

std::vector< std::vector< int > > unpackMWR (std::string packed_data, std::vector< double > &time_stamp, double timeoffset=0) const
 

Private Types

typedef struct
sbn::MWRData::swicheader_t 
swicheader_t
 
typedef struct
sbn::MWRData::mwrpulse_t 
mwrpulse_t
 

Private Member Functions

mwrpulse_t getMWRdata (short *data, int nblock) const
 

Static Private Member Functions

static long flipByte (long data)
 

Detailed Description

Definition at line 6 of file MWRData.h.

Member Typedef Documentation

Member Function Documentation

static long sbn::MWRData::flipByte ( long  data)
inlinestaticprivate

Definition at line 27 of file MWRData.h.

28  {
29  return ((data>>16)&0x0000FFFF) | ((data<<16)&0xFFFF0000);
30  }
MWRData::mwrpulse_t sbn::MWRData::getMWRdata ( short *  data,
int  nblock 
) const
private

Definition at line 45 of file MWRData.cpp.

46 {
47  mwrpulse_t mwrdata;
48 
49  memcpy(&mwrdata.hor, data+nblock*111, 96);
50  memcpy(&mwrdata.ver, data+nblock*111+48, 96);
51  memcpy(&mwrdata.sheader.timesec, data+nblock*111+96, 4);
52  memcpy(&mwrdata.sheader.timensec, data+nblock*111+98, 4);
53  memcpy(&mwrdata.sheader.gpstime1, data+nblock*111+100, 4);
54  memcpy(&mwrdata.sheader.gpstime2, data+nblock*111+102, 4);
55  memcpy(&mwrdata.sheader.boosterevent, data+nblock*111+104, 2);
56  memcpy(&mwrdata.sheader.mievent, data+nblock*111+105, 2);
57  memcpy(&mwrdata.sheader.hz15micnt, data+nblock*111+106, 2);
58  memcpy(&mwrdata.sheader.delta1f, data+nblock*111+107, 4);
59  memcpy(&mwrdata.sheader.pulsemi, data+nblock*111+109, 2);
60  memcpy(&mwrdata.sheader.pulsesc, data+nblock*111+110, 2);
61 
62  mwrdata.sheader.timesec=flipByte(mwrdata.sheader.timesec);
63  mwrdata.sheader.timensec=flipByte(mwrdata.sheader.timensec);
64  mwrdata.sheader.gpstime1=flipByte(mwrdata.sheader.gpstime1);
65  mwrdata.sheader.gpstime2=flipByte(mwrdata.sheader.gpstime2);
66  mwrdata.sheader.delta1f=flipByte(mwrdata.sheader.delta1f);
67 
68  return mwrdata;
69 
70 }
struct sbn::MWRData::mwrpulse_t mwrpulse_t
static long flipByte(long data)
Definition: MWRData.h:27
std::vector< std::vector< int > > sbn::MWRData::unpackMWR ( std::string  packed_data,
std::vector< double > &  time_stamp,
double  timeoffset = 0 
) const

Definition at line 13 of file MWRData.cpp.

14 {
15 
16  std::vector<std::vector<int> > unpacked_data;
17  unpacked_data.resize(4);
18  short data[444];
19 
20  std::vector<std::string> row(0);
21  boost::split(row, packed_data, boost::is_any_of(","));
22  if (row.size()==447) {
23  for (int i=3;i<447;i++) {
24  data[i-3]=atoi(row[i].c_str());
25  }
26  string devname=row[1].substr(0,8);
27  for (int idev=0;idev<4;idev++) {
28  mwrpulse_t mwr=getMWRdata(data,idev);
29  time_stamp.push_back(mwr.sheader.timesec+mwr.sheader.timensec/1000000000.+timeoffset);
30  for (int ich=0;ich<48;ich++) {
31  unpacked_data[idev].push_back(mwr.hor[ich]);
32  }
33  for (int ich=0;ich<48;ich++) {
34  unpacked_data[idev].push_back(mwr.ver[ich]);
35  }
36  }
37  } else {
38  cout <<"BeamSpillInfoRetriever: MRWData: Bad data!"<<endl;
39  return unpacked_data;
40  }
41 
42  return unpacked_data;
43 }
struct sbn::MWRData::mwrpulse_t mwrpulse_t
mwrpulse_t getMWRdata(short *data, int nblock) const
Definition: MWRData.cpp:45
BEGIN_PROLOG could also be cout

The documentation for this class was generated from the following files: