MCPcopy Create free account
hub / github.com/apache/singa / PrepareNextField

Method PrepareNextField

src/io/binfile_reader.cc:120–134  ·  view source on GitHub ↗

if the buf does not have the next complete field, read data from disk

Source from the content-addressed store, hash-verified

118
119// if the buf does not have the next complete field, read data from disk
120bool BinFileReader::PrepareNextField(int size) {
121 if (offset_ + size > bufsize_) {
122 bufsize_ -= offset_;
123 memcpy(buf_, buf_ + offset_, bufsize_);
124 offset_ = 0;
125 if (fdat_.eof()) {
126 return false;
127 } else {
128 fdat_.read(buf_ + bufsize_, capacity_ - bufsize_);
129 bufsize_ += (int) fdat_.gcount();
130 CHECK_LE(size, bufsize_) << "Field size is too large: " << size;
131 }
132 }
133 return true;
134}
135
136} // namespace io
137} // namespace singa

Callers

nothing calls this directly

Calls 1

readMethod · 0.80

Tested by

no test coverage detected