size_t BufferedStream::write(const Buffer &buffer, size_t length) { m_writeBuffer.copyIn(buffer, length); size_t result = flushWrite(length); // Partial writes not allowed MORDOR_ASSERT(result == length); return result; }
size_t BufferedStream::write(const void *buffer, size_t length) { m_writeBuffer.reserve(std::max(m_bufferSize, length)); m_writeBuffer.copyIn(buffer, length); size_t result = flushWrite(length); // Partial writes not allowed MORDOR_ASSERT(result == length); return result; }
virtual void write(const byte *buf, size_t n) { while (n != 0) { size_t remain = block_size_ - block_pos_; if (remain == 0) { remain = flushWrite(); dcheck(remain != 0); } const size_t count = std::min(n, remain); std::copy(buf, buf + count, block_data_ + block_pos_); block_pos_ += count; buf += count; n -= count; } }
void SDICameraControl::write(const byte data[], int dataLength) const { if(shieldInitialized) { // Ensure any pending writes are complete before writing new data flushWrite(); // Set up control override length and data regWrite8(kRegOCLENGTH, dataLength); regWrite(kRegOCDATA, data, dataLength); // Arm the control override bank regWrite8(kRegOCARM, kRegOCARM_ARM_Mask); } else { memcpy(outputBuffer, data, dataLength); outputLength = dataLength; } }
virtual void put(int c) { if (UNLIKELY(block_pos_ >= block_size_)) { flushWrite(); } block_data_[block_pos_++] = c; }
void flush() { flushWrite(); }
~BitWriter() { flushWrite(); };