CrystalSpace

Public API Reference

csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler > Class Template Reference

A templated array class. More...

#include <csutil/dirtyaccessarray.h>

Inheritance diagram for csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >:

List of all members.

Public Member Functions

 csDirtyAccessArray (size_t in_capacity=0, const CapacityHandler &ch=CapacityHandler())
 Initialize object to have initial capacity of in_capacity elements.
T * Detach ()
 Get the pointer to the start of the array and set internal array pointer to null and size and capacity to 0.
const T * GetArray () const
 Get the pointer to the start of the array.
T * GetArray ()
 Get the pointer to the start of the array.
T * GetArrayCopy ()
 Get a copy of the array.

Detailed Description

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
class csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >

A templated array class.

The only difference with csArray is that this class allows you to get the address of the internal array. This is of course dangerous so use of this class should be restricted and avoided.

The main use of this class is when you absolutely need access to the internal array that is in this class. This can be useful if you want to access some external module (like OpenGL).

Definition at line 49 of file dirtyaccessarray.h.


Constructor & Destructor Documentation

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::csDirtyAccessArray ( size_t  in_capacity = 0,
const CapacityHandler &  ch = CapacityHandler() 
) [inline]

Initialize object to have initial capacity of in_capacity elements.

The storage increase depends on the specified capacity handler. The default capacity handler accepts a threshold parameter by which the storage is increased each time the upper bound is exceeded.

Definition at line 59 of file dirtyaccessarray.h.


Member Function Documentation

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
T* csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::Detach (  )  [inline]

Get the pointer to the start of the array and set internal array pointer to null and size and capacity to 0.

After the data is detached it's up to you to destroy all elements and free the memory!

Definition at line 105 of file dirtyaccessarray.h.

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
const T* csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetArray (  )  const [inline]

Get the pointer to the start of the array.

Definition at line 74 of file dirtyaccessarray.h.

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
T* csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetArray (  )  [inline]

Get the pointer to the start of the array.

Definition at line 65 of file dirtyaccessarray.h.

template<class T, class ElementHandler = csArrayElementHandler<T>, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = CS::Container::ArrayCapacityDefault>
T* csDirtyAccessArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetArrayCopy (  )  [inline]

Get a copy of the array.

The caller is responsible for deleting this with 'delete[]'. Returns 0 if there are no items in the array.

Definition at line 87 of file dirtyaccessarray.h.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1