Services Products Downloads About Us Contact
 
My Account
 
Services
Consulting
Business Solutions
Skills
Training
Support
 
Professional Products
molib™
the sandbox™
sswf™
odbcpp™
Trinity℠
Order Made!®
PHP eFax
PHP Pay Junction
Instant Cart™
DLF™
Documents & White Papers
 
Consumer Products
Turn Watcher™
Download Our Products
CafePress
Forums
 
About Us
History
News Room
Blogs
FAQ
Terms and Conditions
Your Privacy
 
Contact Us
Contact
Press Kit
Jobs
Service Request
 
 
 
Languages Available:  français   español 
 

CLASS

moBuffer

NAME

Constructor - initialize a database object
Destructor - get rid of a database object

VERSION

Version: 1.2.0

SYNOPSIS

moBuffer(void *data = 0, unsigned long size = 0, unsigned long max = 0);
moBuffer(const moBuffer& buffer);
~moBuffer();

moBuffer& operator = (const moBuffer& buffer);

PARAMETERS

data - a user data pointer used as the data buffer
size - the size of the valid data in the buffer
max - the exact size of the data buffer
buffer - another buffer to copy in this buffer

DESCRIPTION

The constructor of the buffer object can be used to also set the buffer to the given data buffer of the specified size. By default an empty buffer is created.

When data is a null pointer, then the size and max parameters are ignored.

The copy and assignment operators will duplicate the source buffer data in a newly allocated memory buffer.

IMPORTANT: the data pointer given to the buffer must have been allocated with the new[] operator and it will be managed by the buffer object thus deleting this buffer object will also delete the user data pointer.

Note that the max value should be at least equal to size. When max is smaller than size, it is set to size. It can be used to avoid some reallocations.

The destructor ensures that the buffer is deleted from memory.

RETURN VALUE

The assignment operator returns a reference to this.

SEE ALSO

Set

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


CLASS

moBuffer

NAME

Set - changes the current buffer with a new one

VERSION

Version: 1.2.0

SYNOPSIS

void Set(void *data = 0, unsigned long size = 0, unsigned long max = 0);
void Set(const moBuffer& buffer);

PARAMETERS

data - the new user data used to replace the buffer data
size - the size of the valid data in the buffer
max - the exact size of the data buffer
buffer - a buffer to duplicate in this buffer

DESCRIPTION

The Set() function deletes any previously defined data buffer and replaces it with the new information.

When data is a null pointer, then the size and max parameters are ignored.

IMPORTANT: the data pointer given to the buffer must have been allocated with the new[] operator and it will be managed by the buffer object thus deleting this buffer object will also delete this data pointer.

SEE ALSO

Constructor

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


CLASS

moBuffer

NAME

SetSize - change the size of the buffer

VERSION

Version: 1.2.0

SYNOPSIS

void SetSize(unsigned long size, bool clear = false);

PARAMETERS

size - the new buffer size
clear - whether to clear the extra bytes

DESCRIPTION

The SetSize() function enlarges the buffer and optionally clears the new data bytes. Note that the data pointer may change in this operation.

The buffer can also be shrunk in which case the clear flag is unused.

Setting the size to zero will clear the buffer (make it empty).

SEE ALSO

Copy, Append, Insert, Fill

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


CLASS

moBuffer

NAME

Empty - clears the data buffer
IsEmpty - returns true when the buffer is empty

VERSION

Version: 1.2.0

SYNOPSIS

void Empty(void);
bool IsEmpty(void) const;

DESCRIPTION

The Empty() function is equivalent to setting the buffer to a null data pointer (Set()) or setting the size to zero (SetSize(0)).

The IsEmpty() function returns true whenever the size of the buffer is zero.

SEE ALSO

Set, SetSize

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


CLASS

moBuffer

NAME

Copy - copy the specified data in the buffer
Append - append the specified data to the buffer
Insert - insert the specified data in the buffer
Fill - fill repeating the specified data in the buffer

VERSION

Version: 1.2.0

SYNOPSIS

void Copy(unsigned long pos, const void *data, unsigned long size);
void Append(const void *data, unsigned long size);
void Insert(unsigned long pos, const data *data, unsigned long size);
void Fill(unsigned long pos, unsigned long length, const data *data, unsigned long size);

PARAMETERS

pos - where in the buffer the data is copied
data - the user data to be copied
size - the number of bytes to copy of data, if zero, nothing happens
length - total size copied

DESCRIPTION

The Copy() function can be used to change the data in a buffer. It will automatically enlarge the buffer if required. (i.e. if you try to copy past the end of the current buffer.)

The Append() function can be used to enlarge the buffer and copy the specified data at the end.

The Insert() function can be used to enlarge the buffer and copy the specified data at the specified position. Data which were at that position before is first moved after the new data.

The Fill() function can be used to fill a buffer with some arbitrary pattern. The pattern is copied over length bytes in the buffer at the specified position. The pattern is an array of size bytes. If size or length is zero, nothing happen.

All of these functions will ensure that the buffer is large enough and automatically enlarge the buffer if necessary. This means the data pointer can move in memory.

SEE ALSO

SetSize

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


CLASS

moBuffer

NAME

Get - get the data pointer and its size
void * - cast operator to retrieve the pointer
[un]signed int & [un]signed long - cast operator to retrieve the size

VERSION

Version: 1.2.0

SYNOPSIS

void Get(void *& data, unsigned long& size) const;
operator void * (void) const;
operator const void * (void) const;
operator unsigned int (void) const;
operator signed int (void) const;
operator unsigned long (void) const;
operator signed long (void) const;

PARAMETERS

data - copy the buffer pointer here
size - copy the buffer size here

DESCRIPTION

The Get() function will be used to retrieve a pointer of the data in the buffer and the size of the buffer at once.

The void * cast operator can be used to get the data pointer out of the buffer:

moBuffer buffer;

ptr = (<ptr type>) (void *) buffer;

The integer and long casts can be used to retrieve the size of the buffer:

moBuffer buffer;

size = (long) buffer;

The data pointer returned by this function will certainly change if you are using one of the Set(), SetSize(), Copy(), Append(), Insert() or Fill() functions.

SEE ALSO

SetSize, Set, Constructor, SetSize, Copy, Append, Insert, Fill

COPYRIGHTS

This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.

Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.

AUTHORS

Alexis Wilke, Doug Barbieri


 

Links:
  molib
  the sandbox