#include <FileEndRecord.h>
Inheritance diagram for DybDaq::FileEndRecord:
Public Types | |
typedef std::pair< const char *, unsigned int > | OutputBuffer |
typedef std::vector< OutputBuffer > | OutputBufferList |
typedef std::vector< ByteInspector * > | Bytes |
typedef std::vector< BitsInspector * > | Bits |
Public Member Functions | |
FileEndRecord (const FileTraits::FileDateTime &dateTime, const unsigned int fileEventCount, const unsigned int filePayloadSize, const unsigned int runEventCount, const unsigned int runPayloadSize, const unsigned int status, const FileTraits &traits) | |
Create an instance of this class. | |
FileEndRecord (const ByteBuffer &byteBuffer, const FileTraits &traits) | |
Create an instance of this class. | |
virtual | ~FileEndRecord () |
Destroys this instance of the class. | |
virtual bool | isMarked (unsigned int marker) const |
Returns true if this object contains the specified marker. | |
FileTraits::FileDateTime | dateTime () const |
Returns the date and time thefile was closed. | |
unsigned int | fileEventCount () const |
Returns the number of events contained in this file. | |
unsigned int | filePayloadSize () const |
Returns the size of the payload in this file, in MBs. | |
unsigned int | runEventCount () const |
Returns the number of events contained in this run so far. | |
unsigned int | runPayloadSize () const |
Returns the size of the payload in this run so far, in MBs. | |
unsigned int | status () const |
Returns non-zero value if this is the last file in the run. | |
bool | endMarkerFound () const |
Returns true if the end marker of this record is found. | |
const FileTraits & | fileTraits () const |
Returns the FileTraits instance used to parse this object's buffer. | |
unsigned int | marker () const |
Returns the marker for this FileBuffer. | |
unsigned int | size () const |
Returns the length of this record in 4-byte words. | |
virtual unsigned int | bufferSize () const |
Returns the size, in 4-bytes,, of this object's contents in the buffer. | |
bool | hasDaqTraits () const |
virtual const DaqTraits & | daqTraits () const |
virtual unsigned int | gather (OutputBufferList &outputBuffers) const |
virtual unsigned int | inspect (DaqBuffer::Bytes &inspectors) const |
Static Public Attributes | |
static const unsigned int | kBytesInInt |
static const unsigned int | kUndefinedFormatComponent |
Protected Member Functions | |
virtual unsigned int | formatComponent () const |
Returns the component with the format of this buffer. | |
void | setMarker (const unsigned int marker) |
Sets the marker for this FileBuffer. | |
void | setSize (const unsigned int size) |
Sets the size, in 4-bytes,, of this object's contents in the buffer. | |
const char * | buffer () const |
char * | buffer () |
bool | hasByteBuffer () const |
const ByteBuffer & | byteBuffer () const |
unsigned int | fillInspectors (DaqBuffer::Bytes &inspectors, unsigned int component, unsigned int cursor) const |
virtual bool | readBool (const unsigned int field) const |
virtual int | readInt (const unsigned int field) const |
virtual unsigned char | readUnsignedChar (const unsigned int field) const |
virtual unsigned int | readUnsignedInt (const unsigned int field) const |
virtual void | writeField (const bool value, const unsigned int field) |
virtual void | writeField (const int value, const unsigned int field) |
virtual void | writeField (const unsigned int value, const unsigned int field) |
Private Member Functions | |
FileEndRecord () | |
Suppress default. | |
FileEndRecord (FileEndRecord &rhs) | |
Suppress default. | |
FileEndRecord & | operator= (FileEndRecord &rhs) |
Suppress default. | |
unsigned int | date () const |
Returns date when file was closed, as DDMMYYYY. | |
unsigned int | time () const |
Returns time when file was closed, as HHMMSS. | |
void | setDateTime (const FileTraits::FileDateTime &dateTime) |
Sets the date and time the file was closed. | |
void | setFileEventCount (const unsigned int fileEventCount) |
Sets the number of events contained in this file. | |
void | setFilePayloadSize (const unsigned int filePayloadSize) |
Sets the size of the payload in this file, in MBs. | |
void | setRunEventCount (const unsigned int runEventCount) |
Sets the number of events contained in this run so far. | |
void | setRunPayloadSize (const unsigned int runPayloadSize) |
Sets the size of the payload in this run so far, in MBs. | |
void | setStatus (const unsigned int status) |
Sets non-zero value if this is the last file in the run. | |
void | setDate (const unsigned int date) |
Sets date when file was closed, as DDMMYYYY. | |
void | setTime (const unsigned int time) |
Sets time when file was closed, as HHMMSS. |
Definition at line 18 of file FileEndRecord.h.
FileEndRecord::FileEndRecord | ( | const FileTraits::FileDateTime & | dateTime, | |
const unsigned int | fileEventCount, | |||
const unsigned int | filePayloadSize, | |||
const unsigned int | runEventCount, | |||
const unsigned int | runPayloadSize, | |||
const unsigned int | status, | |||
const FileTraits & | traits | |||
) |
Create an instance of this class.
Definition at line 17 of file FileEndRecord.cc.
00023 : 00024 FileBuffer(new char[traits.recordSize(FileTraits::kFileEndRecord) * kBytesInInt], 00025 traits, 00026 FileTraits::kFileEndRecord) { 00027 setDateTime(dateTime); 00028 setFileEventCount(fileEventCount); 00029 setFilePayloadSize(filePayloadSize); 00030 setRunEventCount(runEventCount); 00031 setRunPayloadSize(runPayloadSize); 00032 setStatus(status); 00033 writeField(traits.marker(FileTraits::kFileEndMarker), 00034 FileTraits::kEndFileMarker); 00035 }
FileEndRecord::FileEndRecord | ( | const ByteBuffer & | byteBuffer, | |
const FileTraits & | traits | |||
) |
Create an instance of this class.
Definition at line 37 of file FileEndRecord.cc.
00038 : 00039 FileBuffer(byteBuffer, 00040 traits) { 00041 }
FileEndRecord::~FileEndRecord | ( | ) | [virtual] |
DybDaq::FileEndRecord::FileEndRecord | ( | ) | [private] |
Suppress default.
DybDaq::FileEndRecord::FileEndRecord | ( | FileEndRecord & | rhs | ) | [private] |
Suppress default.
bool FileEndRecord::isMarked | ( | unsigned int | marker | ) | const [virtual] |
Returns true if this object contains the specified marker.
Implements DybDaq::FileBuffer.
Definition at line 46 of file FileEndRecord.cc.
00046 { 00047 return FileTraits::kFileEndRecord == marker; 00048 }
FileTraits::FileDateTime FileEndRecord::dateTime | ( | ) | const |
Returns the date and time thefile was closed.
Definition at line 50 of file FileEndRecord.cc.
00050 { 00051 const unsigned int closeDate = date(); 00052 const unsigned int closeTime = time(); 00053 struct tm tmStruct; 00054 tmStruct.tm_sec = closeTime % 100U;; 00055 tmStruct.tm_min = (closeTime /100U) % 100U; 00056 tmStruct.tm_hour = (closeTime /10000U) % 100U; 00057 tmStruct.tm_mday = (closeDate / 1000000U) % 100U; 00058 tmStruct.tm_mon = ((closeDate / 10000U) % 100U) - 1; 00059 tmStruct.tm_year = (closeDate % 10000U) - 1900; 00060 tmStruct.tm_wday = 0; 00061 tmStruct.tm_yday = 0; 00062 tmStruct.tm_isdst = 0; 00063 return tmStruct; 00064 }
unsigned int FileEndRecord::fileEventCount | ( | ) | const |
Returns the number of events contained in this file.
Definition at line 66 of file FileEndRecord.cc.
00066 { 00067 return readUnsignedInt(FileTraits::kFileEventCount); 00068 }
unsigned int FileEndRecord::filePayloadSize | ( | ) | const |
Returns the size of the payload in this file, in MBs.
Definition at line 70 of file FileEndRecord.cc.
00070 { 00071 return readUnsignedInt(FileTraits::kFilePayloadSize); 00072 }
unsigned int FileEndRecord::runEventCount | ( | ) | const |
Returns the number of events contained in this run so far.
Definition at line 74 of file FileEndRecord.cc.
00074 { 00075 return readUnsignedInt(FileTraits::kRunEventCount); 00076 }
unsigned int FileEndRecord::runPayloadSize | ( | ) | const |
Returns the size of the payload in this run so far, in MBs.
Definition at line 78 of file FileEndRecord.cc.
00078 { 00079 return readUnsignedInt(FileTraits::kRunPayloadSize); 00080 }
unsigned int FileEndRecord::status | ( | ) | const |
Returns non-zero value if this is the last file in the run.
Definition at line 82 of file FileEndRecord.cc.
00082 { 00083 return readUnsignedInt(FileTraits::kFileEndStatus); 00084 }
bool FileEndRecord::endMarkerFound | ( | ) | const |
Returns true if the end marker of this record is found.
Definition at line 86 of file FileEndRecord.cc.
00086 { 00087 return fileTraits().marker(FileTraits::kEndFileMarker) == readUnsignedInt(FileTraits::kFileEndStatus); 00088 }
unsigned int FileEndRecord::formatComponent | ( | ) | const [protected, virtual] |
Returns the component with the format of this buffer.
Reimplemented from DybDaq::DaqBuffer.
Definition at line 98 of file FileEndRecord.cc.
00098 { 00099 return FileTraits::kFileEndRecord; 00100 }
FileEndRecord& DybDaq::FileEndRecord::operator= | ( | FileEndRecord & | rhs | ) | [private] |
Suppress default.
unsigned int FileEndRecord::date | ( | ) | const [private] |
Returns date when file was closed, as DDMMYYYY.
Definition at line 90 of file FileEndRecord.cc.
00090 { 00091 return readUnsignedInt(FileTraits::kFileCloseDate); 00092 }
unsigned int FileEndRecord::time | ( | ) | const [private] |
Returns time when file was closed, as HHMMSS.
Definition at line 94 of file FileEndRecord.cc.
00094 { 00095 return readUnsignedInt(FileTraits::kFileCloseTime); 00096 }
void FileEndRecord::setDateTime | ( | const FileTraits::FileDateTime & | dateTime | ) | [private] |
Sets the date and time the file was closed.
Definition at line 102 of file FileEndRecord.cc.
00102 { 00103 setDate(dateTime.tm_year + 1900 00104 + (dateTime.tm_mon + 1) * 10000 00105 + dateTime.tm_mday * 1000000); 00106 setTime(dateTime.tm_sec 00107 + dateTime.tm_min * 100 00108 + dateTime.tm_hour * 10000); 00109 }
void FileEndRecord::setFileEventCount | ( | const unsigned int | fileEventCount | ) | [private] |
Sets the number of events contained in this file.
Definition at line 111 of file FileEndRecord.cc.
00111 { 00112 writeField(fileEventCount, 00113 FileTraits::kFileEventCount); 00114 }
void FileEndRecord::setFilePayloadSize | ( | const unsigned int | filePayloadSize | ) | [private] |
Sets the size of the payload in this file, in MBs.
Definition at line 116 of file FileEndRecord.cc.
00116 { 00117 writeField(filePayloadSize, 00118 FileTraits::kFilePayloadSize); 00119 }
void FileEndRecord::setRunEventCount | ( | const unsigned int | runEventCount | ) | [private] |
Sets the number of events contained in this run so far.
Definition at line 121 of file FileEndRecord.cc.
00121 { 00122 writeField(runEventCount, 00123 FileTraits::kRunEventCount); 00124 }
void FileEndRecord::setRunPayloadSize | ( | const unsigned int | runPayloadSize | ) | [private] |
Sets the size of the payload in this run so far, in MBs.
Definition at line 126 of file FileEndRecord.cc.
00126 { 00127 writeField(runPayloadSize, 00128 FileTraits::kRunPayloadSize); 00129 }
void FileEndRecord::setStatus | ( | const unsigned int | status | ) | [private] |
Sets non-zero value if this is the last file in the run.
Definition at line 131 of file FileEndRecord.cc.
00131 { 00132 writeField(status, 00133 FileTraits::kFileEndStatus); 00134 }
void FileEndRecord::setDate | ( | const unsigned int | date | ) | [private] |
Sets date when file was closed, as DDMMYYYY.
Definition at line 136 of file FileEndRecord.cc.
00136 { 00137 writeField(date, 00138 FileTraits::kFileCloseDate); 00139 }
void FileEndRecord::setTime | ( | const unsigned int | time | ) | [private] |
Sets time when file was closed, as HHMMSS.
Definition at line 141 of file FileEndRecord.cc.
00141 { 00142 writeField(time, 00143 FileTraits::kFileCloseTime); 00144 }
const FileTraits & FileBuffer::fileTraits | ( | ) | const [inherited] |
Returns the FileTraits instance used to parse this object's buffer.
Definition at line 40 of file FileBuffer.cc.
00040 { 00041 return dynamic_cast<const FileTraits&>(daqTraits()); 00042 }
unsigned int FileBuffer::marker | ( | ) | const [inherited] |
Returns the marker for this FileBuffer.
Definition at line 44 of file FileBuffer.cc.
00044 { 00045 return readUnsignedInt(FileTraits::kMarker); 00046 }
unsigned int FileBuffer::size | ( | ) | const [inherited] |
Returns the length of this record in 4-byte words.
Definition at line 48 of file FileBuffer.cc.
00048 { 00049 return readUnsignedInt(FileTraits::kRecordSize); 00050 }
unsigned int FileBuffer::bufferSize | ( | ) | const [virtual, inherited] |
Returns the size, in 4-bytes,, of this object's contents in the buffer.
Implements DybDaq::DaqBuffer.
Definition at line 52 of file FileBuffer.cc.
00052 { 00053 return size(); 00054 }
void FileBuffer::setMarker | ( | const unsigned int | marker | ) | [protected, inherited] |
Sets the marker for this FileBuffer.
Definition at line 56 of file FileBuffer.cc.
00056 { 00057 writeField(marker, 00058 FileTraits::kMarker); 00059 }
void FileBuffer::setSize | ( | const unsigned int | size | ) | [protected, inherited] |
Sets the size, in 4-bytes,, of this object's contents in the buffer.
Definition at line 61 of file FileBuffer.cc.
00061 { 00062 writeField(size, 00063 FileTraits::kRecordSize); 00064 }