MIDI::DataBuffer Class Reference

#include <DataBuffer.h>

List of all members.

Public Member Functions

 DataBuffer ()
 Constructor.
 DataBuffer (const DataBuffer &o)
 Copy constructor.
 DataBuffer (byte data[], unsigned int size)
 DataBuffer (unsigned int maxsize)
bytedata ()
unsigned int size ()
unsigned int maxsize ()
void writeVariableLength (dword data)
void write (byte data)
void write (byte data[], unsigned int size)
void write (DataBuffer data)
void seek (int pos)
void remove (int numBytes)

Detailed Description

Class that represents a read/write buffer of bytes. Can be navigated using interfaces like a C++ STD stream.

Also contains functions that help to read data as if it were stored in a MIDI file. These include support for variable-length fields.

As of right now, buffers can be expanded only to a specified maximum length.

A buffer owns its data.

Definition at line 41 of file DataBuffer.h.


Constructor & Destructor Documentation

MIDI::DataBuffer::DataBuffer (  ) 

Constructor.

Creates an empty buffer, with 0 maximum length

Definition at line 31 of file DataBuffer.cpp.

MIDI::DataBuffer::DataBuffer ( const DataBuffer o  ) 

Copy constructor.

Definition at line 35 of file DataBuffer.cpp.

MIDI::DataBuffer::DataBuffer ( byte  data[],
unsigned int  size 
)

Initializes the data by copying the first "size" number of bytes from the data array. The data is copied explicitely.

This buffer can store at most size bytes.

Parameters:
data The data to copy
size Number of bytes to copy from the data array

Definition at line 46 of file DataBuffer.cpp.

MIDI::DataBuffer::DataBuffer ( unsigned int  maxsize  ) 

Initialize an empty data buffer that can store at most maxsize bytes.

Parameters:
maxsize Maximum number of bytes that one can store in this buffer

Definition at line 54 of file DataBuffer.cpp.


Member Function Documentation

byte * MIDI::DataBuffer::data (  ) 
Returns:
Array access to the underlying data

Definition at line 61 of file DataBuffer.cpp.

unsigned int MIDI::DataBuffer::maxsize (  ) 
Returns:
The maximum possible number of bytes that can be stored in this buffer

Definition at line 71 of file DataBuffer.cpp.

void MIDI::DataBuffer::remove ( int  numBytes  ) 

Removes number of bytes at the current positions. All bytes after the removed ones are shifted down.

Parameters:
numBytes Number of bytes to remove

Definition at line 134 of file DataBuffer.cpp.

void MIDI::DataBuffer::seek ( int  pos  ) 

Moves the position counter somewhere else. The beginning of the buffer is pos=0

Parameters:
pos Position to seek to

Definition at line 129 of file DataBuffer.cpp.

unsigned int MIDI::DataBuffer::size (  ) 
Returns:
Number of bytes stored in this buffer

Definition at line 66 of file DataBuffer.cpp.

void MIDI::DataBuffer::write ( DataBuffer  data  ) 

Write all data from another MIDI::DataBuffer to this buffer.

Parameters:
data MIDI::DataBuffer to copy from

Definition at line 123 of file DataBuffer.cpp.

void MIDI::DataBuffer::write ( byte  data[],
unsigned int  size 
)

Write a whole set of bytes into the buffer. Increments position counter by size.

Parameters:
data Array of data to write
size Number of bytes from data[] to write
void MIDI::DataBuffer::write ( byte  data  ) 

Write a byte into the buffer, and increment the position counter/

Parameters:
data byte to write

Definition at line 100 of file DataBuffer.cpp.

void MIDI::DataBuffer::writeVariableLength ( dword  data  ) 

Write a number of variable length into the buffer, at current pos.

Parameters:
data The number to write. Can be at most 4 bytes.

Definition at line 76 of file DataBuffer.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 5 16:09:42 2010 for libmidi by  doxygen 1.6.1