Made to Order Software Corporation Logo

libsswf: sswf::MemBuffer Class Reference

A type of smart pointer used to manage memory buffers. More...

#include <libsswf.h>

Inheritance diagram for sswf::MemBuffer:

:ItemBase :Vectors :Action :ActionDictionary::string_t :ActionFunction::parameter_t :ActionPushData::action_immediate_t :Edges :Edges::array_edge_t :Envelope :Event :State :Style :TagExport::export_t :TagFont::font_glyph_t :TagFont::font_kern_t :TagImport::import_t :TagShape::shape_record_t :TagShape::shape_what_t :TagText::text_define_t

List of all members.

Public Member Functions

void AttachBuffer (Buffer *buffer)
 Attaches the specified buffer to this memory buffer.
BufferGetBuffer (void) const
 Retrieve the Buffer of this MemBuffer.
 MemBuffer (void)
 Initializes a memory buffer.
virtual ~MemBuffer ()
 Cleans up a memory buffer.

Private Attributes


Detailed Description

The MemBuffer class can be viewed as a buffer of memory which needs to be automatically managed.

The idea is to derive new classes from MemBuffer. These classes can then be managed by an sswf::MemoryManager. This is necessary for items put in vectors, the vectors themselves and a few othe objects which would otherwise not be managed.

A good examples are the actions. All the actions put in a vector are managed by that vector. In effect, when you destroy that vector, it automatically deletes all the actions.

See also:


Constructor & Destructor Documentation

MemBuffer::MemBuffer ( void   ) 

The constructor initializes the memory buffer with a null (i.e. no buffer).

References f_buffer.

MemBuffer::~MemBuffer (  )  [virtual]

The destructor ensures that any buffer still allocated gets deleted.

References f_buffer.

Member Function Documentation

void MemBuffer::AttachBuffer ( Buffer buffer  ) 

This function is used when you attach a MemBuffer to a Buffer. The Buffer saves itself in the MemBuffer. In effect the item derived from this MemBuffer class becomes part of a MemoryManager.

It is an error to get attached to multiple buffers without first clearing the MemBuffer once. This should not be necessary since once an item is in a MemoryManager it does not need to be moved.

buffer The buffer to attach to this MemBuffer

References sswf::assert(), f_buffer, and sswf::Buffer::Info().

Referenced by sswf::Buffer::Buffer().

Buffer * MemBuffer::GetBuffer ( void   )  const

This function is used to retrieve the Buffer which was previously attached with this MemBuffer object.

A pointer to the Buffer or NULL when no buffer was attached

References f_buffer.

Member Data Documentation

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

Generated on Wed Mar 18 15:13:58 2009 for libsswf by  doxygen 1.5.5