#include <RawRecord.h>
Inheritance diagram for DayaBay::RawCalibrationParameters:
Public Member Functions | |
RawCalibrationParameters (unsigned int *buffer=0, unsigned int version=0, bool isOwner=false) | |
RawCalibrationParameters (DayaBay::RawRecord &record, bool adopt=false) | |
virtual | ~RawCalibrationParameters () |
unsigned int | detectorId () const |
unsigned int | axis () const |
unsigned int | sourceId () const |
unsigned int | zPosition () const |
unsigned int | duration () const |
unsigned int | ledFrequency () const |
unsigned int | ltbMode () const |
virtual std::ostream & | dump (std::ostream &str) |
unsigned int | type () const |
unsigned int | size () const |
unsigned int | version () const |
bool | isFileStart () const |
bool | isFileName () const |
bool | isMetadata () const |
bool | isRunParameters () const |
bool | isCalibrationParameters () const |
bool | isDataSeparator () const |
bool | isFileEnd () const |
DayaBay::RawRecord * | clone () const |
unsigned int * | buffer () const |
unsigned int | bufferSize () const |
bool | isOwner () const |
void | setOwner (bool isOwner=true) |
virtual bool | isValid () const |
unsigned int * | getPointer (const unsigned int &line) const |
unsigned int | getValue (const unsigned int &line, const unsigned int &firstBit=0, const unsigned int &bitLength=32) const |
char * | getString (const unsigned int &line, const unsigned int &byteOffset=0) const |
Static Public Member Functions | |
static unsigned int | minimumSize () |
static DayaBay::RawRecord * | makeNewRecord (unsigned int *buffer=0, unsigned int version=0, bool isOwner=false) |
Definition at line 101 of file RawRecord.h.
DayaBay::RawCalibrationParameters::RawCalibrationParameters | ( | unsigned int * | buffer = 0 , |
|
unsigned int | version = 0 , |
|||
bool | isOwner = false | |||
) |
DayaBay::RawCalibrationParameters::RawCalibrationParameters | ( | DayaBay::RawRecord & | record, | |
bool | adopt = false | |||
) |
Definition at line 434 of file RawRecord.cc.
00437 : RawRecord(record,adopt) 00438 { 00439 // Construct from another RawRecord 00440 // If adopt==true, then take over ownership of the 00441 // memory buffer (if the input record is the current owner) 00442 }
DayaBay::RawCalibrationParameters::~RawCalibrationParameters | ( | ) | [virtual] |
unsigned int DayaBay::RawCalibrationParameters::detectorId | ( | ) | const |
Definition at line 449 of file RawRecord.cc.
00450 { 00451 return this->getValue(RecordFormat::CalibrationParameters::detectorIdLine); 00452 }
unsigned int DayaBay::RawCalibrationParameters::axis | ( | ) | const |
Definition at line 454 of file RawRecord.cc.
00455 { 00456 return this->getValue(RecordFormat::CalibrationParameters::axisLine); 00457 }
unsigned int DayaBay::RawCalibrationParameters::sourceId | ( | ) | const |
Definition at line 459 of file RawRecord.cc.
00460 { 00461 return this->getValue(RecordFormat::CalibrationParameters::sourceIdLine); 00462 }
unsigned int DayaBay::RawCalibrationParameters::zPosition | ( | ) | const |
Definition at line 464 of file RawRecord.cc.
00465 { 00466 return this->getValue(RecordFormat::CalibrationParameters::zPositionLine); 00467 }
unsigned int DayaBay::RawCalibrationParameters::duration | ( | ) | const |
Definition at line 469 of file RawRecord.cc.
00470 { 00471 return this->getValue(RecordFormat::CalibrationParameters::durationLine); 00472 }
unsigned int DayaBay::RawCalibrationParameters::ledFrequency | ( | ) | const |
Definition at line 474 of file RawRecord.cc.
00475 { 00476 return this->getValue(RecordFormat::CalibrationParameters::ledFrequencyLine); 00477 }
unsigned int DayaBay::RawCalibrationParameters::ltbMode | ( | ) | const |
Definition at line 479 of file RawRecord.cc.
00480 { 00481 return this->getValue(RecordFormat::CalibrationParameters::ltbModeLine); 00482 }
std::ostream & DayaBay::RawCalibrationParameters::dump | ( | std::ostream & | str | ) | [virtual] |
Reimplemented from DayaBay::RawRecord.
Definition at line 484 of file RawRecord.cc.
00484 { 00485 // Print the record information 00486 str << "CalibrationParameters {" << std::endl << " "; 00487 this->RawRecord::dump(str); 00488 return str << " detectorId: " << this->detectorId() << std::endl 00489 << " axis: " << this->axis() << std::endl 00490 << " sourceId: " << this->sourceId() << std::endl 00491 << " zPosition: " << this->zPosition() << " mm"<< std::endl 00492 << " duration: " << this->duration() << std::endl 00493 << " ledFrequency: " << this->ledFrequency() << std::endl 00494 << " ltbMode: " << this->ltbMode() << " }" << std::endl; 00495 }
unsigned int DayaBay::RawRecord::type | ( | ) | const [inherited] |
Definition at line 40 of file RawRecord.cc.
00041 { 00042 // Return the type of this RawRecord 00043 return this->getValue(RecordFormat::Record::typeLine); 00044 }
unsigned int DayaBay::RawRecord::size | ( | ) | const [inherited] |
Definition at line 46 of file RawRecord.cc.
00047 { 00048 // Return the size of this record, in integer segments 00049 return this->getValue(RecordFormat::Record::sizeLine); 00050 }
unsigned int DayaBay::RawRecord::version | ( | ) | const [inherited] |
Definition at line 52 of file RawRecord.cc.
00053 { 00054 // Version of this record 00055 return m_version; 00056 }
unsigned int DayaBay::RawRecord::minimumSize | ( | ) | [static, inherited] |
Definition at line 34 of file RawRecord.cc.
00035 { 00036 // Minimum size for all raw records. 00037 return RecordFormat::Record::minimumSize; 00038 }
bool DayaBay::RawRecord::isFileStart | ( | ) | const [inherited] |
Definition at line 58 of file RawRecord.cc.
00059 { 00060 // Is this a file start record? 00061 return (this->type()==RecordFormat::FileStart::type); 00062 }
bool DayaBay::RawRecord::isFileName | ( | ) | const [inherited] |
Definition at line 64 of file RawRecord.cc.
00065 { 00066 // Is this a file name record? 00067 return (this->type()==RecordFormat::FileName::type); 00068 }
bool DayaBay::RawRecord::isMetadata | ( | ) | const [inherited] |
Definition at line 70 of file RawRecord.cc.
00071 { 00072 // Is this a metadata record? 00073 return (this->type()==RecordFormat::Metadata::type); 00074 }
bool DayaBay::RawRecord::isRunParameters | ( | ) | const [inherited] |
Definition at line 76 of file RawRecord.cc.
00077 { 00078 // Is this a run parameters record? 00079 return (this->type()==RecordFormat::RunParameters::type); 00080 }
bool DayaBay::RawRecord::isCalibrationParameters | ( | ) | const [inherited] |
Definition at line 82 of file RawRecord.cc.
00083 { 00084 // Is this a calibration parameters record? 00085 return (this->type()==RecordFormat::CalibrationParameters::type); 00086 }
bool DayaBay::RawRecord::isDataSeparator | ( | ) | const [inherited] |
Definition at line 88 of file RawRecord.cc.
00089 { 00090 // Is this a data separator record? 00091 return (this->type()==RecordFormat::DataSeparator::type); 00092 }
bool DayaBay::RawRecord::isFileEnd | ( | ) | const [inherited] |
Definition at line 94 of file RawRecord.cc.
00095 { 00096 // Is this a file end record? 00097 return (this->type()==RecordFormat::FileEnd::type); 00098 }
DayaBay::RawRecord * DayaBay::RawRecord::clone | ( | ) | const [inherited] |
Definition at line 100 of file RawRecord.cc.
00101 { 00102 // Make a full copy of this record 00103 unsigned int* newBuffer = 0; 00104 if(this->buffer()){ 00105 unsigned int size = this->size(); 00106 if( this->isDataSeparator() ){ 00107 // Add additional lines for data block contents 00108 DayaBay::RawDataSeparator dataSeparator(this->buffer(), this->version()); 00109 size += (dataSeparator.blockSize() + sizeof(unsigned int)-1) 00110 / sizeof(unsigned int); 00111 } 00112 if( size>0 ){ 00113 memcpy( newBuffer, this->buffer(), size*sizeof(unsigned int) ); 00114 if(!newBuffer) return 0; 00115 } 00116 } 00117 return DayaBay::RawRecord::makeNewRecord(newBuffer, m_version, 00118 true /*isOwner*/); 00119 }
DayaBay::RawRecord * DayaBay::RawRecord::makeNewRecord | ( | unsigned int * | buffer = 0 , |
|
unsigned int | version = 0 , |
|||
bool | isOwner = false | |||
) | [static, inherited] |
Definition at line 129 of file RawRecord.cc.
00132 { 00133 // Make a new record. Automatically set the correct class type 00134 // using the type() defined in the raw record. 00135 // 00136 // The caller is responsible for deleting the returned record. 00137 00138 DayaBay::RawRecord* newRecord = 0; 00139 // Convert to the proper record type 00140 DayaBay::RawRecord rawRecord(buffer,version); 00141 if( rawRecord.isFileStart() ){ 00142 newRecord = new DayaBay::RawFileStart(buffer, version, isOwner); 00143 }else if( rawRecord.isFileName() ){ 00144 newRecord = new DayaBay::RawFileName(buffer, version, isOwner); 00145 }else if( rawRecord.isMetadata() ){ 00146 newRecord = new DayaBay::RawMetadata(buffer, version, isOwner); 00147 }else if( rawRecord.isRunParameters() ){ 00148 newRecord = new DayaBay::RawRunParameters(buffer, version, isOwner); 00149 }else if( rawRecord.isCalibrationParameters() ){ 00150 newRecord = new DayaBay::RawCalibrationParameters(buffer, version, isOwner); 00151 }else if( rawRecord.isDataSeparator() ){ 00152 newRecord = new DayaBay::RawDataSeparator(buffer, version, isOwner); 00153 }else if( rawRecord.isFileEnd() ){ 00154 newRecord = new DayaBay::RawFileEnd(buffer, version, isOwner); 00155 }else{ 00156 newRecord = new DayaBay::RawRecord(buffer, version, isOwner); 00157 } 00158 return newRecord; 00159 }
unsigned int * DayaBay::RawBuffer::buffer | ( | ) | const [inherited] |
Definition at line 52 of file RawBuffer.cc.
00053 { 00054 // Return the pointer to the internal memory buffer 00055 return m_buffer; 00056 }
unsigned int DayaBay::RawBuffer::bufferSize | ( | ) | const [inherited] |
Definition at line 58 of file RawBuffer.cc.
00059 { 00060 // Return the allocated size of the internal memory buffer, if known 00061 return m_bufferSize; 00062 }
bool DayaBay::RawBuffer::isOwner | ( | ) | const [inherited] |
Definition at line 64 of file RawBuffer.cc.
00065 { 00066 // Does this RawBuffer own this memory buffer? 00067 return m_isOwner; 00068 }
void DayaBay::RawBuffer::setOwner | ( | bool | isOwner = true |
) | [inherited] |
bool DayaBay::RawBuffer::isValid | ( | ) | const [virtual, inherited] |
Definition at line 74 of file RawBuffer.cc.
00075 { 00076 // Does this RawBuffer contain data? 00077 return (m_buffer != 0); 00078 }
unsigned int * DayaBay::RawBuffer::getPointer | ( | const unsigned int & | line | ) | const [inherited] |
Definition at line 80 of file RawBuffer.cc.
00081 { 00082 // Return a pointer to a specific line in the data block 00083 if(m_bufferSize>0 && line>=m_bufferSize) return 0; 00084 return (m_buffer + line); 00085 }
unsigned int DayaBay::RawBuffer::getValue | ( | const unsigned int & | line, | |
const unsigned int & | firstBit = 0 , |
|||
const unsigned int & | bitLength = 32 | |||
) | const [inherited] |
Definition at line 87 of file RawBuffer.cc.
00090 { 00091 // Read a value from the memory buffer 00092 // line = line number in the memory block (line = integer length) 00093 // firstBit = first bit to read (max=31) 00094 // bitLength = length of bits to read (max=32) 00095 if(bitLength>32 || firstBit>31) return 0; 00096 unsigned int* pointer = this->getPointer(line); 00097 if(!pointer) return 0; 00098 // Catch request for full line 00099 if(firstBit==0 && bitLength==32) return *pointer; 00100 // Prepare bit mask 00101 unsigned int oneBit = 0x1; 00102 unsigned int mask = 0; 00103 for(unsigned int shift=0; shift<bitLength; shift++) 00104 mask += (oneBit << shift); 00105 // Shift value, mask, and return 00106 return (*pointer >> firstBit) & mask; 00107 }
char * DayaBay::RawBuffer::getString | ( | const unsigned int & | line, | |
const unsigned int & | byteOffset = 0 | |||
) | const [inherited] |
Definition at line 109 of file RawBuffer.cc.
00111 { 00112 // Return a char pointer to a specific byte in the data block 00113 // line = line number in the memory block (line = integer length) 00114 // byteOffset = offset if string starts at an uneven byte position (max=3) 00115 if(byteOffset>3) return 0; 00116 unsigned int* pointer = this->getPointer(line); 00117 if(!pointer) return 0; 00118 return (char*)(pointer + byteOffset); 00119 }