11 #ifndef EVIO_6_0_RECORDOUTPUT_H
12 #define EVIO_6_0_RECORDOUTPUT_H
183 uint32_t maxEventCount = 1000000,
184 uint32_t maxBufferSize = 8*
ONE_MEG,
188 RecordOutput(std::shared_ptr<ByteBuffer> & buffer, uint32_t maxEventCount,
204 bool allowedIntoRecord(uint32_t length);
230 bool addEvent(const uint8_t * event, uint32_t eventLen, uint32_t extraDataLen = 0);
232 bool addEvent(const std::vector<uint8_t> & event);
233 bool addEvent(const std::vector<uint8_t> & event,
size_t offset, uint32_t eventLen, uint32_t extraDataLen = 0);
242 bool addEvent(std::shared_ptr<
EvioBank> & event, uint32_t extraDataLen = 0);
249 void build(std::shared_ptr<
ByteBuffer> userHeader);
257 #endif //EVIO_6_0_RECORDOUTPUT_H
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
uint32_t getMaxEventCount() const
Get the maximum number of events allowed in this record.
Definition: RecordOutput.cpp:330
static constexpr int ONE_MEG
Maximum number of events per record.
Definition: RecordOutput.h:110
const Compressor::CompressionType getCompressionType() const
Get the compression type of the contained record.
Definition: RecordOutput.cpp:387
std::shared_ptr< RecordHeader > header
Header of this Record.
Definition: RecordOutput.h:168
bool roomForEvent(uint32_t length) const
Is there room in this record's memory for an additional event of the given length in bytes (length NO...
Definition: RecordOutput.cpp:439
const ByteOrder & getByteOrder() const
Get the byte order of the record to be built.
Definition: RecordOutput.cpp:414
uint32_t getInternalBufferCapacity() const
Get the capacity of the internal buffer in bytes.
Definition: RecordOutput.cpp:357
bool addEvent(const uint8_t *event, uint32_t eventLen, uint32_t extraDataLen=0)
Adds an event's ByteBuffer into the record.
Definition: RecordOutput.cpp:482
Singleton class used to provide data compression and decompression in a variety of formats...
Definition: Compressor.h:41
CompressionType
Enum of supported data compression types.
Definition: Compressor.h:65
Numerical values associated with endian byte order.
Definition: ByteOrder.h:53
uint32_t RECORD_BUFFER_SIZE
Size of buffer holding built record in bytes.
Definition: RecordOutput.h:133
size_t startingPosition
The starting position of a user-given buffer.
Definition: RecordOutput.h:152
void transferDataForReading(const RecordOutput &rec)
Copy the contents of the arg into this object and get data buffer ready for reading.
Definition: RecordOutput.cpp:244
uint32_t userBufferSize
The number of initially available bytes to be written into in the user-given buffer, that go from position to limit.
Definition: RecordOutput.h:138
const std::shared_ptr< ByteBuffer > getBinaryBuffer() const
Get the internal ByteBuffer used to construct binary representation of this record.
Definition: RecordOutput.cpp:378
const HeaderType getHeaderType() const
Get the header type of the contained record.
Definition: RecordOutput.cpp:398
bool hasUserProvidedBuffer() const
Was the internal buffer provided by the user?
Definition: RecordOutput.cpp:407
std::shared_ptr< ByteBuffer > recordIndex
This buffer stores event lengths (in bytes) ONLY.
Definition: RecordOutput.h:155
Definition: Compressor.h:66
std::shared_ptr< ByteBuffer > recordBinary
Buffer in which to put constructed (& compressed) binary record.
Definition: RecordOutput.h:165
RecordOutput()
Default, no-arg constructor.
Definition: RecordOutput.cpp:18
Class which handles the creation and use of Evio & HIPO Records.
Definition: RecordOutput.h:105
uint32_t indexSize
Number of valid bytes in recordIndex buffer.
Definition: RecordOutput.h:145
ByteOrder byteOrder
Byte order of record byte arrays to build.
Definition: RecordOutput.h:171
bool oneTooMany() const
Does adding one more event exceed the event count limit?
Definition: RecordOutput.cpp:449
std::shared_ptr< ByteBuffer > recordEvents
This buffer stores event data ONLY.
Definition: RecordOutput.h:158
This class is used to store relevant info about an evio container (bank, segment, or tag segment)...
Definition: EvioNode.h:41
This holds a CODA Bank structure.
Definition: EvioBank.h:36
void setBuffer(std::shared_ptr< ByteBuffer > &buf)
Reset internal buffers and set the buffer in which to build this record.
Definition: RecordOutput.cpp:211
uint32_t MAX_BUFFER_SIZE
Size of some internal buffers in bytes.
Definition: RecordOutput.h:124
std::shared_ptr< ByteBuffer > recordData
This buffer stores data that will be compressed.
Definition: RecordOutput.h:161
uint32_t getUncompressedSize() const
Get the current uncompressed size of the record in bytes.
Definition: RecordOutput.cpp:346
void build()
Builds the record.
Definition: RecordOutput.cpp:841
uint32_t MAX_EVENT_COUNT
Maximum number of events per record.
Definition: RecordOutput.h:113
uint32_t eventCount
Number of events written to this Record.
Definition: RecordOutput.h:141
void setStartingBufferPosition(size_t pos)
Set the starting position of the user-given buffer being written into.
Definition: RecordOutput.cpp:829
void reset()
Reset internal buffers.
Definition: RecordOutput.cpp:804
uint32_t getEventCount() const
Get the number of events written so far into the buffer.
Definition: RecordOutput.cpp:371
uint32_t eventSize
Number of valid bytes in recordEvents buffer.
Definition: RecordOutput.h:148
bool userProvidedBuffer
Is recordBinary a user provided buffer?
Definition: RecordOutput.h:174
uint32_t getUserBufferSize() const
Get the number of initially available bytes to be written into in the user-given buffer, that goes from position to limit.
Definition: RecordOutput.cpp:338
static const ByteOrder ENDIAN_LOCAL
Local host's byte order.
Definition: ByteOrder.h:61
std::shared_ptr< RecordHeader > & getHeader()
Get the general header of this record.
Definition: RecordOutput.cpp:364