CS::DataBuffer< Allocator > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
CS::DataBuffer< Allocator > Class Template Reference

This is an implementation of iDataBuffer interface. More...

`#include <csutil/databuf.h>`

Inheritance diagram for CS::DataBuffer< Allocator >:

List of all members.

## Public Member Functions
| DataBuffer (size_t iSize)
| Construct an preallocated data buffer (filled with garbage initially)
| DataBuffer (size_t iSize, const Allocator &alloc)
| Construct an preallocated data buffer (filled with garbage initially)
| DataBuffer (char *iData, size_t iSize, bool should_delete=true)
| Construct an data buffer object given a existing pointer.
| DataBuffer (char *iData, size_t iSize, bool should_delete, const Allocator &alloc)
| Construct an data buffer object given a existing pointer.
| DataBuffer (iDataBuffer *source, bool appendNull=true)
| Duplicate an existing data buffer. Also appends a 0 char.
virtual char * | GetData () const
| Get the buffer as an abstract pointer.
bool | GetDeleteOnDestruct () const
| Return true if this databuffer will destroy its memory on destruction.
virtual size_t | GetSize () const
| Query the buffer size.
virtual | ~DataBuffer ()
| Destroy (free) the buffer.

## Detailed Description

### template<class Allocator = Memory::AllocatorMalloc>
class CS::DataBuffer< Allocator >

This is an implementation of iDataBuffer interface.

The object is extremely lightweight and is recommended for use in plugins as a mean to transparently exchange abstract data between plugins.

Definition at line 41 of file databuf.h.

## Constructor & Destructor Documentation

template<class Allocator = Memory::AllocatorMalloc>

CS::DataBuffer< Allocator >::DataBuffer | ( | size_t | iSize | ) | `[inline]`

Construct an preallocated data buffer (filled with garbage initially)

Definition at line 53 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

CS::DataBuffer< Allocator >::DataBuffer | ( | size_t | iSize,
|  | const Allocator & | alloc
| ) |  | `[inline]`

Construct an preallocated data buffer (filled with garbage initially)

Definition at line 60 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

CS::DataBuffer< Allocator >::DataBuffer | ( | char * | iData,
|  | size_t | iSize,
|  | bool | should_delete = `true`
| ) |  | `[inline]`

Construct an data buffer object given a existing pointer.

The pointer must be allocated by an allocator compatible to the given.

Definition at line 72 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

CS::DataBuffer< Allocator >::DataBuffer | ( | char * | iData,
|  | size_t | iSize,
|  | bool | should_delete,
|  | const Allocator & | alloc
| ) |  | `[inline]`

Construct an data buffer object given a existing pointer.

The pointer must be allocated by an allocator compatible to the given.

Definition at line 83 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

CS::DataBuffer< Allocator >::DataBuffer | ( | iDataBuffer< Allocator > * | source,
|  | bool | appendNull = `true`
| ) |  | `[inline]`

Duplicate an existing data buffer. Also appends a 0 char.

Definition at line 92 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

virtual CS::DataBuffer< Allocator >::~DataBuffer | ( |  | ) | `[inline, virtual]`

Destroy (free) the buffer.

Definition at line 110 of file databuf.h.

## Member Function Documentation

template<class Allocator = Memory::AllocatorMalloc>

virtual char* CS::DataBuffer< Allocator >::GetData | ( |  | ) | const`[inline, virtual]`

Get the buffer as an abstract pointer.

Implements iDataBuffer.

Definition at line 121 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

bool CS::DataBuffer< Allocator >::GetDeleteOnDestruct | ( |  | ) | const`[inline]`

Return true if this databuffer will destroy its memory on destruction.

Definition at line 128 of file databuf.h.

template<class Allocator = Memory::AllocatorMalloc>

virtual size_t CS::DataBuffer< Allocator >::GetSize | ( |  | ) | const`[inline, virtual]`

Query the buffer size.

Implements iDataBuffer.

Definition at line 117 of file databuf.h.

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

- csutil/databuf.h