mxnet
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
dmlc::RecordIOWriter Class Reference

writer of binary recordio binary format for recordio recordio format: magic lrecord data pad More...

#include <recordio.h>

Collaboration diagram for dmlc::RecordIOWriter:
Collaboration graph

Public Member Functions

 RecordIOWriter (Stream *stream)
 constructor More...
 
void WriteRecord (const void *buf, size_t size)
 write record to the stream More...
 
void WriteRecord (const std::string &data)
 write record to the stream More...
 
size_t except_counter (void) const
 
size_t Tell (void)
 tell the current position of the input stream More...
 

Static Public Member Functions

static uint32_t EncodeLRec (uint32_t cflag, uint32_t length)
 encode the lrecord More...
 
static uint32_t DecodeFlag (uint32_t rec)
 decode the flag part of lrecord More...
 
static uint32_t DecodeLength (uint32_t rec)
 decode the length part of lrecord More...
 

Static Public Attributes

static const uint32_t kMagic = 0xced7230a
 magic number of recordio note: (kMagic >> 29U) & 7 > 3 this ensures lrec will not be kMagic More...
 

Detailed Description

writer of binary recordio binary format for recordio recordio format: magic lrecord data pad

cflag was used to handle (rare) special case when magic number occured in the data sequence.

In such case, the data is splitted into multiple records by the cells of magic number

(1) cflag == 0: this is a complete record; (2) cflag == 1: start of a multiple-rec; cflag == 2: middle of multiple-rec; cflag == 3: end of multiple-rec

Constructor & Destructor Documentation

dmlc::RecordIOWriter::RecordIOWriter ( Stream stream)
inlineexplicit

constructor

Parameters
streamthe stream to be constructed

Member Function Documentation

static uint32_t dmlc::RecordIOWriter::DecodeFlag ( uint32_t  rec)
inlinestatic

decode the flag part of lrecord

Parameters
recthe lrecord
Returns
the flag
static uint32_t dmlc::RecordIOWriter::DecodeLength ( uint32_t  rec)
inlinestatic

decode the length part of lrecord

Parameters
recthe lrecord
Returns
the length
static uint32_t dmlc::RecordIOWriter::EncodeLRec ( uint32_t  cflag,
uint32_t  length 
)
inlinestatic

encode the lrecord

Parameters
cflagcflag part of the lrecord
lengthlength part of lrecord
Returns
the encoded data
size_t dmlc::RecordIOWriter::except_counter ( void  ) const
inline
Returns
number of exceptions(occurance of magic number) during the writing process
size_t dmlc::RecordIOWriter::Tell ( void  )
inline

tell the current position of the input stream

void dmlc::RecordIOWriter::WriteRecord ( const void *  buf,
size_t  size 
)

write record to the stream

Parameters
bufthe buffer of memory region
sizethe size of record to write out
void dmlc::RecordIOWriter::WriteRecord ( const std::string &  data)
inline

write record to the stream

Parameters
datathe data to write out

Member Data Documentation

const uint32_t dmlc::RecordIOWriter::kMagic = 0xced7230a
static

magic number of recordio note: (kMagic >> 29U) & 7 > 3 this ensures lrec will not be kMagic


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