BeamDataImp Class Reference

List of all members.

Classes

struct  DeviceData

Public Member Functions

 BeamDataImp ()
 ~BeamDataImp ()
void clear ()
int32_t words ()
int32_t * create_block ()
void delete_block (int32_t *data)
void header (int32_t sec, int32_t nsec, int32_t spill, int32_t event, int32_t delay)
DeviceDataget_device (string name)
void set_device_header (string name, int32_t sec, int32_t msec)
void append_payload (string name, int32_t value[2])
string & current_file ()

Private Types

typedef map< string, DeviceDataPayload
typedef Payload::iterator PayloadItr

Private Attributes

string fCurrentFile
int32_t fSeconds
int32_t fNanosecs
int32_t fSpillcount
int32_t fTclkEvent
int32_t fTclkDelay
Payload fPayload

Detailed Description

Definition at line 35 of file BeamData.cc.


Member Typedef Documentation

typedef map<string,DeviceData> BeamDataImp::Payload [private]

Definition at line 45 of file BeamData.cc.

typedef Payload::iterator BeamDataImp::PayloadItr [private]

Definition at line 46 of file BeamData.cc.


Constructor & Destructor Documentation

BeamDataImp::BeamDataImp (  )  [inline]

Definition at line 51 of file BeamData.cc.

References clear(), and fCurrentFile.

00051 { this->clear(); fCurrentFile = ""; }

BeamDataImp::~BeamDataImp (  )  [inline]

Definition at line 52 of file BeamData.cc.

00052 {}


Member Function Documentation

void BeamDataImp::append_payload ( string  name,
int32_t  value[2] 
) [inline]

Definition at line 156 of file BeamData.cc.

References BeamDataImp::DeviceData::data, and get_device().

Referenced by BeamData::add_device_value().

00156                                                        {
00157         DeviceData& d = get_device(name);
00158         d.data.push_back(value[0]);
00159         d.data.push_back(value[1]);
00160     }

void BeamDataImp::clear (  )  [inline]

Definition at line 54 of file BeamData.cc.

References fNanosecs, fPayload, fSeconds, fSpillcount, fTclkDelay, and fTclkEvent.

Referenced by BeamDataImp(), and BeamData::start_block().

00054                  {
00055         fSeconds = fNanosecs = fSpillcount = 0;
00056         fTclkEvent = fTclkDelay = 0;
00057         fPayload.clear();
00058     }

int32_t* BeamDataImp::create_block (  )  [inline]

Definition at line 78 of file BeamData.cc.

References count, BeamDataImp::DeviceData::data, done(), fNanosecs, fPayload, fSeconds, fSpillcount, fTclkDelay, fTclkEvent, hdr_indx_blockid, hdr_indx_checksum, hdr_indx_nsec, hdr_indx_sec, hdr_indx_size, hdr_indx_spillcnt, it, kMdBlockBeamMonHeader, kMdBlockBeamMonPayload, make_block_id(), BeamDataImp::DeviceData::msec, pld_indx_blockid, pld_indx_checksum, pld_indx_clbk_delay, pld_indx_clbk_event, pld_indx_data_start, pld_indx_num_devices, pld_indx_size, rdxsum_fill(), BeamDataImp::DeviceData::sec, words(), and zzzz_last.

Referenced by BeamData::send_data().

00078                             {
00079         int32_t  siz  = this->words();
00080         int32_t* data = new int32_t[siz];
00081         
00082         // The header block
00083         int32_t* hdr = data;
00084         hdr[hdr_indx_size]     = zzzz_last;
00085         hdr[hdr_indx_checksum] = 0;
00086         hdr[hdr_indx_blockid]  = make_block_id(kMdBlockBeamMonHeader);
00087         hdr[hdr_indx_sec]      = fSeconds;
00088         hdr[hdr_indx_nsec]     = fNanosecs;
00089         hdr[hdr_indx_spillcnt] = fSpillcount;
00090         rdxsum_fill(hdr,0);
00091 
00092         // The payload block
00093         int32_t* pld = data+hdr[hdr_indx_size];
00094         siz -= hdr[hdr_indx_size];
00095         pld[pld_indx_size]        = siz;
00096         pld[pld_indx_checksum]    = 0;
00097         pld[pld_indx_blockid]     = make_block_id(kMdBlockBeamMonPayload);
00098         pld[pld_indx_clbk_event]  = fTclkEvent;
00099         pld[pld_indx_clbk_delay]  = fTclkDelay;
00100         pld[pld_indx_num_devices] = fPayload.size();
00101 
00102         int32_t count=0, index = pld_indx_data_start;
00103         PayloadItr it, done = fPayload.end();
00104         for (it = fPayload.begin(); it != done; ++it) {
00105             string name = it->first;
00106             DeviceData& dd = it->second;
00107 
00108             // Pack the ACNET name.  This does it in machine order
00109             // unpacking assumes it is written on ix86 ordering.
00110             pld[index++] = (name[0]<<24)+(name[1]<<16)+(name[2]<<8)+name[3];
00111             pld[index++] = (name[4]<<24)+(name[5]<<16)+(name[6]<<8)+name[7];
00112 
00113             // Set the relative timestamp
00114             pld[index++] = dd.sec;
00115             pld[index++] = dd.msec;
00116 
00117             // Pack number of device values and the values themselves.
00118             int32_t nvalues = dd.data.size();
00119             pld[index++] = nvalues;
00120             for (int32_t ind=0; ind<nvalues; ++ind) pld[index++] = dd.data[ind];
00121             ++count;
00122         }
00123         rdxsum_fill(data+6,0);
00124 
00125         assert (siz == index);
00126         assert (count == pld[pld_indx_num_devices]);
00127         return data;
00128     }

string& BeamDataImp::current_file (  )  [inline]

Definition at line 162 of file BeamData.cc.

References fCurrentFile.

Referenced by BeamData::close_file(), and BeamData::current_filename().

00162 { return fCurrentFile; }

void BeamDataImp::delete_block ( int32_t *  data  )  [inline]

Definition at line 129 of file BeamData.cc.

Referenced by BeamData::send_data().

00129 { delete [] data; }

DeviceData& BeamDataImp::get_device ( string  name  )  [inline]

Definition at line 140 of file BeamData.cc.

References fPayload, and it.

Referenced by append_payload(), and set_device_header().

00140                                         {
00141         // space pad name
00142         while (name.size() < 8u) name.push_back(' ');
00143 
00144         PayloadItr it = fPayload.find(name);
00145         if (it == fPayload.end()) {
00146             fPayload[name] = DeviceData();
00147             return fPayload[name];
00148         }
00149         else return it->second;
00150     }

void BeamDataImp::header ( int32_t  sec,
int32_t  nsec,
int32_t  spill,
int32_t  event,
int32_t  delay 
) [inline]

Definition at line 131 of file BeamData.cc.

References fNanosecs, fSeconds, fSpillcount, fTclkDelay, and fTclkEvent.

Referenced by BeamData::start_block().

00132                                               {
00133         fSeconds = sec;
00134         fNanosecs = nsec;
00135         fSpillcount = spill;
00136         fTclkEvent = event;
00137         fTclkDelay = delay;
00138     }

void BeamDataImp::set_device_header ( string  name,
int32_t  sec,
int32_t  msec 
) [inline]

Definition at line 151 of file BeamData.cc.

References get_device(), BeamDataImp::DeviceData::msec, and BeamDataImp::DeviceData::sec.

Referenced by BeamData::set_device_header().

00151                                                                    {
00152         DeviceData& d = get_device(name);
00153         d.sec = sec;
00154         d.msec = msec;
00155     }

int32_t BeamDataImp::words (  )  [inline]

Definition at line 59 of file BeamData.cc.

References done(), fPayload, it, pld_indx_data_start, pld_nvalues_offset, and zzzz_last.

Referenced by create_block(), and BeamData::send_data().

00059                     {
00060         int32_t s = 0;
00061         // header block is constant size
00062         s += zzzz_last;
00063         // Number of words to get to start of payload
00064         s += pld_indx_data_start; 
00065 
00066         // Offset from above index + 1 gives number of values in the
00067         // prefix of each device data
00068         s += (pld_nvalues_offset+1) * fPayload.size();
00069 
00070         // Finally count up the actual payloads
00071         PayloadItr it, done = fPayload.end();
00072         for (it = fPayload.begin(); it != done; ++it) {
00073             s += it->second.data.size();
00074         }
00075         return s;
00076     }


Member Data Documentation

string BeamDataImp::fCurrentFile [private]

Definition at line 36 of file BeamData.cc.

Referenced by BeamDataImp(), and current_file().

int32_t BeamDataImp::fNanosecs [private]

Definition at line 37 of file BeamData.cc.

Referenced by clear(), create_block(), and header().

Definition at line 47 of file BeamData.cc.

Referenced by clear(), create_block(), get_device(), and words().

int32_t BeamDataImp::fSeconds [private]

Definition at line 37 of file BeamData.cc.

Referenced by clear(), create_block(), and header().

int32_t BeamDataImp::fSpillcount [private]

Definition at line 37 of file BeamData.cc.

Referenced by clear(), create_block(), and header().

int32_t BeamDataImp::fTclkDelay [private]

Definition at line 38 of file BeamData.cc.

Referenced by clear(), create_block(), and header().

int32_t BeamDataImp::fTclkEvent [private]

Definition at line 38 of file BeamData.cc.

Referenced by clear(), create_block(), and header().


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

Generated on 24 Apr 2018 for loon by  doxygen 1.6.1