NOvACheckSum.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/NOvACheckSum.h"
2 
3 namespace daqdataformats {
4 
5  //--------------------------------------------------------------------------
6  // Initialize the singleton pointer to NULL
7  NOvACheckSum* NOvACheckSum::_instanceID = NULL;
8 
9  //--------------------------------------------------------------------------
12 
13  //--------------------------------------------------------------------------
14  /*! getInstance method returns the current instance if there is one
15  or creates the initial instance if there is not one */
17  if(_instanceID == NULL) // Check if there is an instance active
18  _instanceID = new NOvACheckSum(); // If there is not, make a new one
19 
20  return _instanceID;
21  }// end of NOvACheckSum::getInstance
22 
23 
24  //--------------------------------------------------------------------------
25  uint32_t NOvACheckSum::processCRC(void* buffer, uint32_t size){
26 
27  /// Reset _CRC32 object
28  _CRC32.reset();
29  /// Calculate CRC
30  _CRC32.process_bytes((char*)buffer, size * 4);
31 
32  /// return it
33  return _CRC32.checksum();
34  }
35 
36 
37 }// end of daqdataformats namespace
nova_crc_32_type _CRC32
CRC-32C object. Used when producing CRC.
Definition: NOvACheckSum.h:24
static NOvACheckSum * _instanceID
Instance pointer for the singleton class.
Definition: NOvACheckSum.h:22
~NOvACheckSum()
Default Destructor.
uint32_t processCRC(void *buffer, uint32_t size)
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
static NOvACheckSum * getInstance()
Method to obtain the class instance.
NOvACheckSum()
Default Constructor. Has to be private, since we are using singleton.
Class to hold the data from the FEBs in correct formats.