WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
WXP::Buffer Class Reference

This class creates a generic buffer for data. More...

#include "../include/Buffer.h"

Public Member Functions

int initClass ()
 
int init (int rsize)
 
 Buffer ()
 
 Buffer (int rsize)
 
 ~Buffer ()
 
 Buffer (const Buffer &data)
 
Buffer operator= (const Buffer &data)
 
int copy (const Buffer &data)
 
int clear ()
 
int resize (int rsize)
 
int check (int rsize)
 
int add (unsigned char *dat, int rsize)
 
int insert (int loc, unsigned char *dat, int rsize)
 
int insert (int loc, const Buffer &data)
 
const unsigned char * get ()
 
unsigned char get (int ind)
 
int read (unsigned char *dat, int rsize)
 
int read (Buffer &buf)
 
int read (Buffer &buf, int rsize)
 
int readLine (unsigned char *dat, int rsize)
 
int skipLine ()
 
int clearUsed ()
 
int seek (int num)
 
int inc (int num)
 
int trunc (int num)
 
int equal (int off, const char *str)
 
int getInd ()
 
int getSize ()
 
int getAvail ()
 
int getMax ()
 
int print ()
 
int dump (int off, int num)
 
int dump (int num)
 
int dump ()
 

Friends

class File
 
class Zlib
 
class BZlib
 

Detailed Description

This class creates a generic buffer for data.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Buffer() [1/3]

Buffer::Buffer ( )

Constructor - Initializes the values.

References initClass().

◆ Buffer() [2/3]

Buffer::Buffer ( int  rsize)

Constructor - Size the arrays.

Parameters
rsizeThe max size of the buffer

References init(), and initClass().

◆ ~Buffer()

Buffer::~Buffer ( )

Destructor - deallocate buffer space

◆ Buffer() [3/3]

Buffer::Buffer ( const Buffer buf)

Copy constructor.

Parameters
dataStrings class to copy from

References copy().

Member Function Documentation

◆ add()

int Buffer::add ( unsigned char *  dat,
int  rsize 
)

Adds data to buffer

Parameters
datData to add
rsizeSize of data

References check().

◆ check()

int Buffer::check ( int  rsize)

Checks to see if buffer is large enough to hold data, if not resizes

Parameters
rsizeThe size to check

References resize().

Referenced by add(), insert(), and insert().

◆ clear()

int Buffer::clear ( )

◆ clearUsed()

int Buffer::clearUsed ( )

◆ copy()

int Buffer::copy ( const Buffer buf)

Copy data.

Parameters
bufBuffer class to copy from

References init().

Referenced by Buffer(), and operator=().

◆ dump() [1/3]

int WXP::Buffer::dump ( )
inline

Prints entire buffer

References dump().

Referenced by dump().

◆ dump() [2/3]

int WXP::Buffer::dump ( int  num)
inline

Prints number of bytes from start of buffer

References dump().

Referenced by dump().

◆ dump() [3/3]

int Buffer::dump ( int  off,
int  num 
)

Prints the buffer contents

Parameters
offThe starting point
numThe number of bytes to dump

◆ equal()

int Buffer::equal ( int  off,
const char *  str 
)

Compares data in buffer to string

Parameters
offThe offset into buffer to start compare (<0 from end)
strThe string to compare against
Returns
1=equal, 0=not equal

Referenced by WXP::GiniFile::readData().

◆ get() [1/2]

const unsigned char * WXP::Buffer::get ( )
inline

Return data starting at pointer

Referenced by WXP::NidsFile::readBytes(), WXP::GiniFile::readData(), and WXP::GiniFile::readHeader().

◆ get() [2/2]

unsigned char Buffer::get ( int  i)

Gets a byte from the buffer

Parameters
iThe index to extract
Returns
The byte

◆ getAvail()

int WXP::Buffer::getAvail ( )
inline

Return the number of bytes available in buffer

Referenced by WXP::File::getLine(), WXP::File::read(), WXP::NidsFile::readBytes(), WXP::GiniFile::readData(), and WXP::File::skipLine().

◆ getInd()

int WXP::Buffer::getInd ( )
inline

Return the pointer index

◆ getMax()

int WXP::Buffer::getMax ( )
inline

Return the maximum size of buffer

◆ getSize()

int WXP::Buffer::getSize ( )
inline

Return the buffer size

Referenced by WXP::GiniFile::readData().

◆ inc()

int Buffer::inc ( int  num)

Increments the pointer in the buffer

Parameters
numThe number of bytes to increment pointer

◆ init()

int Buffer::init ( int  rsize)

Initializes the values

Parameters
rsizeThe max size of the buffer

Referenced by Buffer(), copy(), WXP::GiniFile::init(), WXP::Lev2File::init(), and WXP::NidsFile::init().

◆ initClass()

int Buffer::initClass ( )

Initializes the class values

Referenced by Buffer(), and Buffer().

◆ insert() [1/2]

int Buffer::insert ( int  loc,
const Buffer buf 
)

Insert another buffer

Parameters
locLocation in buffer to add new data
bufBuffer class to copy from

References check().

◆ insert() [2/2]

int Buffer::insert ( int  loc,
unsigned char *  dat,
int  rsize 
)

Insert data into buffer

Parameters
locLocation in buffer to add new data
datData to add
rsizeSize of data

References check().

◆ operator=()

Buffer Buffer::operator= ( const Buffer buf)

Assignment operator. Used to overload copying

Parameters
dataString class to copy from

References copy().

◆ print()

int Buffer::print ( )

Prints the values to standard output.

◆ read()

int Buffer::read ( unsigned char *  dat,
int  rsize 
)

Gets a line from the buffer

Parameters
datThe buffer to write to
rsizeThe size of the buffer
Returns
The number of bytes read

Referenced by WXP::File::read(), WXP::File::read(), and WXP::NidsFile::readBytes().

◆ readLine()

int Buffer::readLine ( unsigned char *  dat,
int  rsize 
)

Gets a line from the buffer

Parameters
datThe buffer to write to
rsizeThe size of the buffer
Returns
The number of bytes read

Referenced by WXP::File::getLine().

◆ resize()

int Buffer::resize ( int  rsize)

Resizes the buffer.

Parameters
rsizeThe new maximum size

Referenced by check().

◆ seek()

int Buffer::seek ( int  num)

Sets the pointer in the buffer

Parameters
numThe byte offset

◆ skipLine()

int Buffer::skipLine ( )

Skips a line from the buffer

Returns
1 if saw NL, 0 if not

Referenced by WXP::File::skipLine().

◆ trunc()

int Buffer::trunc ( int  num)

Truncates the data in the buffer

Parameters
numThe new size (num<0 - number of bytes to remove from end)

Referenced by WXP::GiniFile::readData().


The documentation for this class was generated from the following files: