OpenGUI::AutoArray2D< T > Class Template Reference

#include <OpenGUI_Types.h>

List of all members.


Detailed Description

template<typename T>
class OpenGUI::AutoArray2D< T >

An auto growing 2d array of whatever you want.

This array will grow as needed during the standard arrayObject[x][y] access. In order to support this, the held type must allow a default constructor. If you'd like more control over the value of the new data points, you should test the array for adequate size via the growSize() function.

Another nifty option is the lock()/unlock() feature, which allows you to lock the array to prevent all resize operations. If a resize is attempted on a locked array a std::overflow_error exception is thrown. This class is always initialized in an unlocked state.


Public Member Functions

 AutoArray2D (size_t x_size=0, size_t y_size=0)
 Constructor allows for pre-sizing the array, if desired.
size_t getSizeX ()
 Get current width of the array.
size_t getSizeY ()
 Get current height of the array.
void resize (size_t x_size, size_t y_size)
 Resize the array to the given size.
void growSize (size_t x_size, size_t y_size)
 Grows the array to be at least the given size. No action is taken if the array is larger than the needed size.
void growSize (size_t x_size, size_t y_size, T value)
 Same as previous only allows the values of new entries to be provided via the value argument.
void lock ()
 Locks this array from changing size.
void unlock ()
 Unlocks this array so that it can be resized again.


Constructor & Destructor Documentation

template<typename T>
OpenGUI::AutoArray2D< T >::AutoArray2D ( size_t  x_size = 0,
size_t  y_size = 0 
) [inline]

Constructor allows for pre-sizing the array, if desired.


Member Function Documentation

template<typename T>
size_t OpenGUI::AutoArray2D< T >::getSizeX (  )  [inline]

Get current width of the array.

template<typename T>
size_t OpenGUI::AutoArray2D< T >::getSizeY (  )  [inline]

Get current height of the array.

template<typename T>
void OpenGUI::AutoArray2D< T >::growSize ( size_t  x_size,
size_t  y_size,
value 
) [inline]

Same as previous only allows the values of new entries to be provided via the value argument.

template<typename T>
void OpenGUI::AutoArray2D< T >::growSize ( size_t  x_size,
size_t  y_size 
) [inline]

Grows the array to be at least the given size. No action is taken if the array is larger than the needed size.

template<typename T>
void OpenGUI::AutoArray2D< T >::lock (  )  [inline]

Locks this array from changing size.

template<typename T>
void OpenGUI::AutoArray2D< T >::resize ( size_t  x_size,
size_t  y_size 
) [inline]

Resize the array to the given size.

template<typename T>
void OpenGUI::AutoArray2D< T >::unlock (  )  [inline]

Unlocks this array so that it can be resized again.


The documentation for this class was generated from the following file:
Copyright © 2006 OpenGUI | OpenGUI.SF.net
Generated: Fri Jan 5 23:05:26 2007