Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
 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;
   }
 }
Ejemplo n.º 4
0
  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;
    }
  }
Ejemplo n.º 5
0
 virtual void put(int c) {
   if (UNLIKELY(block_pos_ >= block_size_)) {
     flushWrite();
   }
   block_data_[block_pos_++] = c;
 }
Ejemplo n.º 6
0
 void flush() {
   flushWrite();
 }
Ejemplo n.º 7
0
	~BitWriter()
	{
		flushWrite();
	};