![]() |
MPEG CDVA Experimentation Model (CXM)
1.0
Compact Descriptors for Visual Analisys
|
A container class for a byte array, intended to replace all malloc() and new() instructions in the main code. More...
#include <Buffer.h>
Public Member Functions | |
Buffer () | |
virtual | ~Buffer () |
Buffer (size_t size) | |
create a buffer of the given size More... | |
Buffer (unsigned char *data, size_t size) | |
copy the given array into this Buffer More... | |
Buffer (const Buffer &) | |
copy the given Buffer into this Buffer More... | |
Buffer & | operator= (const Buffer &) |
assign a Buffer to another More... | |
void | swap (Buffer &x) |
swap the content of two Buffer(s) More... | |
void | fill (unsigned char value=0) |
fill a Buffer with the given value More... | |
size_t | size () const |
return the current size of the Buffer More... | |
bool | resize (size_t newsize) |
change buffer size; content is lost if newsize if less than the current size More... | |
bool | empty () const |
return true if the Buffer is empty More... | |
void | clear () |
clear the Buffer More... | |
bool | assign (const unsigned char *data, size_t size) |
assign the given data to Buffer More... | |
bool | equals (Buffer &buffer) |
compare if two Buffer(s) are equal (i.e. if they have the same size and contain the same data) More... | |
unsigned char * | data () |
access to Buffer's data as unsigned char (writable) More... | |
const unsigned char * | data () const |
access to Buffer's data as unsigned char (read only) More... | |
char * | sdata () |
access to Buffer's data as signed char (writable) More... | |
const char * | sdata () const |
access to Buffer's data as signed char (read only) More... | |
void | read (const char *fname) |
read Buffer from a file More... | |
void | write (const char *fname) const |
write Buffer to file More... | |
int | compare (const Buffer &other) const |
Compare this buffer with another; return the number of different bytes. More... | |
bool | operator== (const Buffer &other) const |
compare if two Buffer(s) are equal (i.e. if they have the same size and contain the same data) More... | |
A container class for a byte array, intended to replace all malloc() and new() instructions in the main code.
This class properly deallocates memory when an exception is thrown.
mpeg7cdva::Buffer::Buffer | ( | ) |
|
virtual |
mpeg7cdva::Buffer::Buffer | ( | size_t | size | ) |
create a buffer of the given size
mpeg7cdva::Buffer::Buffer | ( | unsigned char * | data, |
size_t | size | ||
) |
copy the given array into this Buffer
bool mpeg7cdva::Buffer::assign | ( | const unsigned char * | data, |
size_t | size | ||
) |
assign the given data to Buffer
void mpeg7cdva::Buffer::clear | ( | ) |
clear the Buffer
int mpeg7cdva::Buffer::compare | ( | const Buffer & | other | ) | const |
Compare this buffer with another; return the number of different bytes.
other | the other Buffer |
unsigned char* mpeg7cdva::Buffer::data | ( | ) |
access to Buffer's data as unsigned char (writable)
const unsigned char* mpeg7cdva::Buffer::data | ( | ) | const |
access to Buffer's data as unsigned char (read only)
bool mpeg7cdva::Buffer::empty | ( | ) | const |
return true if the Buffer is empty
bool mpeg7cdva::Buffer::equals | ( | Buffer & | buffer | ) |
compare if two Buffer(s) are equal (i.e. if they have the same size and contain the same data)
void mpeg7cdva::Buffer::fill | ( | unsigned char | value = 0 | ) |
fill a Buffer with the given value
bool mpeg7cdva::Buffer::operator== | ( | const Buffer & | other | ) | const |
compare if two Buffer(s) are equal (i.e. if they have the same size and contain the same data)
void mpeg7cdva::Buffer::read | ( | const char * | fname | ) |
read Buffer from a file
bool mpeg7cdva::Buffer::resize | ( | size_t | newsize | ) |
change buffer size; content is lost if newsize if less than the current size
char* mpeg7cdva::Buffer::sdata | ( | ) |
access to Buffer's data as signed char (writable)
const char* mpeg7cdva::Buffer::sdata | ( | ) | const |
access to Buffer's data as signed char (read only)
size_t mpeg7cdva::Buffer::size | ( | ) | const |
return the current size of the Buffer
void mpeg7cdva::Buffer::swap | ( | Buffer & | x | ) |
swap the content of two Buffer(s)
void mpeg7cdva::Buffer::write | ( | const char * | fname | ) | const |
write Buffer to file