das2/buffer.h File Reference

Utility to assist with encode and decode operations. More...


Detailed Description

Utility to assist with encode and decode operations.

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "util.h"

Go to the source code of this file.

Data Structures

struct  DasBuf
 Little buffer class to handle accumulating string data. More...

Functions

ErrorCode DasBuf_initReadOnly (DasBuf *pThis, const char *sBuf, size_t uLen)
 Initialize a read-only buffer than points to an external byte array.
int DasBuf_writeFrom (DasBuf *pThis, FILE *pIn, size_t uLen)
 Add generic data to the buffer from a file.
size_t DasBuf_writeSpace (const DasBuf *pThis)
 Get the remaining write space in the buffer.
size_t DasBuf_readOffset (const DasBuf *pThis)
 Get the offset of the read position.
ErrorCode DasBuf_setReadOffset (DasBuf *pThis, size_t uPos)
 Set the offset of the read position.

Function Documentation

ErrorCode DasBuf_initReadOnly ( DasBuf pThis,
const char *  sBuf,
size_t  uLen 
)

Initialize a read-only buffer than points to an external byte array.

This function re-sets the read point for the buffer.

Parameters:
pThis the buffer initialize
sBuf an pre-allocated character buffer to receive new data
uLen the length of the pre-allocated buffer
int DasBuf_writeFrom ( DasBuf pThis,
FILE *  pIn,
size_t  uLen 
)

Add generic data to the buffer from a file.

Returns:
Then number of bytes actually read, or a negative error code if there was a problem reading from the file.
size_t DasBuf_writeSpace ( const DasBuf pThis  ) 

Get the remaining write space in the buffer.

Parameters:
pThis The buffer
Returns:
The number of bytes that may be still be written to the buffer.
size_t DasBuf_readOffset ( const DasBuf pThis  ) 

Get the offset of the read position.

Parameters:
pThis - The buffer to query
Returns:
The difference between the read point and the base of the buffer
ErrorCode DasBuf_setReadOffset ( DasBuf pThis,
size_t  uPos 
)

Set the offset of the read position.

Parameters:
pThis - The buffer in question
uPos - The new read offset from be beginning of the buffer
Returns:
0 on success an positive error code if uPos makes no sense for the buffers current state
 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated on 11 Sep 2016 for Das2 Stream Utilities by  doxygen 1.6.1