本文整理汇总了C++中IOStream::flush方法的典型用法代码示例。如果您正苦于以下问题:C++ IOStream::flush方法的具体用法?C++ IOStream::flush怎么用?C++ IOStream::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOStream
的用法示例。
在下文中一共展示了IOStream::flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rcUpdateColorBuffer_enc
int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
{
renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height);
unsigned char *ptr;
const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &packetSize, 4); ptr += 4;
memcpy(ptr, &colorbuffer, 4); ptr += 4;
memcpy(ptr, &x, 4); ptr += 4;
memcpy(ptr, &y, 4); ptr += 4;
memcpy(ptr, &width, 4); ptr += 4;
memcpy(ptr, &height, 4); ptr += 4;
memcpy(ptr, &format, 4); ptr += 4;
memcpy(ptr, &type, 4); ptr += 4;
stream->flush();
stream->writeFully(&__size_pixels,4);
stream->writeFully(pixels, __size_pixels);
int retval;
stream->readback(&retval, 4);
return retval;
}
示例2: rcCloseColorBuffer_enc
void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer)
{
renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
unsigned char *ptr;
const size_t packetSize = 8 + 4;
ptr = stream->alloc(packetSize);
int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &packetSize, 4); ptr += 4;
memcpy(ptr, &colorbuffer, 4); ptr += 4;
stream->flush();
}