📄 rvdatabuffer.h
字号:
/************************************************************************
File Name : rvdatabuffer.h
Description :
*************************************************************************
Copyright (c) 2000 , RADVision, Inc. All rights reserved.
*************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision Inc.
No part of this publication may be reproduced in any form whatsoever
without written prior approval by RADVision Inc.
RADVision Inc. reserves the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
*************************************************************************
$Revision: $
$Date: 12/08/2000 $
$Author: Scott K. Eaton $
************************************************************************/
#if !defined(RVDATABUFFER_H)
#define RVDATABUFFER_H
#include "rvtypes.h"
#include "rvalloc.h"
#include "rvinet.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************
* RvDataBuffer
******************************************************************/
/*$
{type:
{name: RvDataBuffer}
{superpackage: Util}
{include: rvdatabuffer.h}
{description:
{p: This class represents a network ordered data buffer.
The buffer consists of the physical buffer and the data
located within this buffer. The data length can grow/shrink
in size from both the front and the back within the limits
of the buffer.}
{p: Read methods pull data off the front of the data section of
the buffer.}
{p: Write methods push data onto the front of the data section of
the buffer.}
{p: ReadBack methods pull data off the back of the data section of
the buffer.}
{p: WriteBack methods push data onto the back of the data section of
the buffer.}
{p: ReadAt methods read data from an offset into the data section of
the buffer. This does not affect the size of the data section.}
{p: WriteAt methods write data to an offset into the data section of
the buffer. This does not affect the size of the data section.}
{p: All of these methods translate from/to network/host order as
requires. The data in the buffer is in network order. All methods
return or take host order data.}
}
{methods:
{method: RvDataBuffer* rvDataBufferConstruct(RvDataBuffer* thisPtr, RvUint32 frontCapacity, RvUint32 backCapacity, RvAlloc* allocatorPtr);}
{method: RvDataBuffer* rvDataBufferConstructImport(RvDataBuffer* thisPtr, RvUint8* bufferPtr, RvUint32 bufferLength, RvUint32 dataOffset, RvUint32 dataLength, RvAlloc* allocatorPtr);}
{method: void rvDataBufferDestruct(RvDataBuffer* thisPtr);}
{method: RvUint8* rvDataBufferGetData(RvDataBuffer* thisPtr);}
{method: RvUint32 rvDataBufferGetLength(RvDataBuffer* thisPtr);}
{method: void rvDataBufferSetLength(RvDataBuffer* thisPtr, RvUint32 length);}
{method: RvUint8* rvDataBufferGetBuffer(RvDataBuffer* thisPtr);}
{method: RvUint32 rvDataBufferGetCapacity(RvDataBuffer* thisPtr);}
{method: RvUint32 rvDataBufferGetAvailableFrontCapacity(RvDataBuffer* thisPtr);}
{method: RvUint32 rvDataBufferGetAvailableBackCapacity(RvDataBuffer* thisPtr);}
{method: void rvDataBufferSetDataPosition(RvDataBuffer* thisPtr, RvUint32 offset, RvUint32 length);}
{method: void rvDataBufferRewind(RvDataBuffer* thisPtr, RvUint32 size);}
{method: void rvDataBufferSkip(RvDataBuffer* thisPtr, RvUint32 size);}
{method: void rvDataBufferReadUint8(RvDataBuffer* thisPtr, RvUint8* dataPtr);}
{method: void rvDataBufferWriteUint8(RvDataBuffer* thisPtr, RvUint8 data);}
{method: void rvDataBufferReadUint8Array(RvDataBuffer* thisPtr, RvUint8* dataPtr, RvUint32 length);}
{method: void rvDataBufferWriteUint8Array(RvDataBuffer* thisPtr, RvUint8* dataPtr, RvUint32 length);}
{method: void rvDataBufferFillUint8(RvDataBuffer* thisPtr, RvUint8 data, RvUint32 length);}
{method: void rvDataBufferReadInt8(RvDataBuffer* thisPtr, RvInt8* dataPtr);}
{method: void rvDataBufferWriteInt8(RvDataBuffer* thisPtr, RvInt8 data);}
{method: void rvDataBufferReadUint16(RvDataBuffer* thisPtr, RvUint16* dataPtr);}
{method: void rvDataBufferWriteUint16(RvDataBuffer* thisPtr, RvUint16 data);}
{method: void rvDataBufferReadInt16(RvDataBuffer* thisPtr, RvInt16* dataPtr);}
{method: void rvDataBufferWriteInt16(RvDataBuffer* thisPtr, RvInt16 data);}
{method: void rvDataBufferReadUint32(RvDataBuffer* thisPtr, RvUint32* dataPtr);}
{method: void rvDataBufferWriteUint32(RvDataBuffer* thisPtr, RvUint32 data);}
{method: void rvDataBufferReadInt32(RvDataBuffer* thisPtr, RvInt32* dataPtr);}
{method: void rvDataBufferWriteInt32(RvDataBuffer* thisPtr, RvInt32 data);}
{method: void rvDataBufferRewindBack(RvDataBuffer* thisPtr, RvUint32 size);}
{method: void rvDataBufferSkipBack(RvDataBuffer* thisPtr, RvUint32 size);}
{method: void rvDataBufferReadBackUint8(RvDataBuffer* thisPtr, RvUint8* dataPtr);}
{method: void rvDataBufferWriteBackUint8(RvDataBuffer* thisPtr, RvUint8 data);}
{method: void rvDataBufferReadBackUint8Array(RvDataBuffer* thisPtr, RvUint8* dataPtr, RvUint32 length);}
{method: void rvDataBufferWriteBackUint8Array(RvDataBuffer* thisPtr, RvUint8* dataPtr, RvUint32 length);}
{method: void rvDataBufferFillBackUint8(RvDataBuffer* thisPtr, RvUint8 data, RvUint32 length);}
{method: void rvDataBufferReadBackInt8(RvDataBuffer* thisPtr, RvInt8* dataPtr);}
{method: void rvDataBufferWriteBackInt8(RvDataBuffer* thisPtr, RvInt8 data);}
{method: void rvDataBufferReadBackUint16(RvDataBuffer* thisPtr, RvUint16* dataPtr);}
{method: void rvDataBufferWriteBackUint16(RvDataBuffer* thisPtr, RvUint16 data);}
{method: void rvDataBufferReadBackInt16(RvDataBuffer* thisPtr, RvInt16* dataPtr);}
{method: void rvDataBufferWriteBackInt16(RvDataBuffer* thisPtr, RvInt16 data);}
{method: void rvDataBufferReadBackUint32(RvDataBuffer* thisPtr, RvUint32* dataPtr);}
{method: void rvDataBufferWriteBackUint32(RvDataBuffer* thisPtr, RvUint32 data);}
{method: void rvDataBufferReadBackInt32(RvDataBuffer* thisPtr, RvInt32* dataPtr);}
{method: void rvDataBufferWriteBackInt32(RvDataBuffer* thisPtr, RvInt32 data);}
{method: void rvDataBufferReadAtUint8(RvDataBuffer* thisPtr, RvUint32 index, RvUint8* dataPtr);}
{method: void rvDataBufferWriteAtUint8(RvDataBuffer* thisPtr, RvUint32 index, RvUint8 data);}
{method: void rvDataBufferReadAtInt8(RvDataBuffer* thisPtr, RvUint32 index, RvInt8* dataPtr);}
{method: void rvDataBufferWriteAtInt8(RvDataBuffer* thisPtr, RvUint32 index, RvInt8 data);}
{method: void rvDataBufferReadAtUint16(RvDataBuffer* thisPtr, RvUint32 index, RvUint16* dataPtr);}
{method: void rvDataBufferWriteAtUint16(RvDataBuffer* thisPtr, RvUint32 index, RvUint16 data);}
{method: void rvDataBufferReadAtInt16(RvDataBuffer* thisPtr, RvUint32 index, RvInt16* dataPtr);}
{method: void rvDataBufferWriteAtInt16(RvDataBuffer* thisPtr, RvUint32 index, RvInt16 data);}
{method: void rvDataBufferReadAtUint32(RvDataBuffer* thisPtr, RvUint32 index, RvUint32* dataPtr);}
{method: void rvDataBufferWriteAtUint32(RvDataBuffer* thisPtr, RvUint32 index, RvUint32 data);}
{method: void rvDataBufferReadAtInt32(RvDataBuffer* thisPtr, RvUint32 index, RvInt32* dataPtr);}
{method: void rvDataBufferWriteAtInt32(RvDataBuffer* thisPtr, RvUint32 index, RvInt32 data);}
{method: int rvDataBufferToString(const RvDataBuffer* thisPtr, char* buffer, size_t bufferSize, const char* prefix);}
}
}
$*/
/**************************************************************************
Buffer organization:
buffer data dataEnd bufferEnd
| | | |
V V V V
+-----------------+-------------------------+-----------------+
| Free Space | Data | Free Space |
+-----------------+-------------------------+-----------------+
|<------------------------ Capacity ------------------------->|
|<-- Available -->|<------- Length -------->|<-- Available -->|
Front Back
Capacity Capacity
NOTES:
o Read/Writes occur at the "data" pointer. A write moves the pointer towards
the "buffer" pointer then writes the data in network order. A read gets the
data at the "data" pointer and converts it to host order, then moves the
"data" pointer towards the "dataEnd" pointer.
o Rewind adds bytes to Data without writing by moving the "data" pointer towards
the "buffer" pointer.
o Skip removes bytes from Data without reading by moving the "data" pointer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -