#include <OpenGUI_Types.h>
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. | |
| OpenGUI::AutoArray2D< T >::AutoArray2D | ( | size_t | x_size = 0, |
|
| size_t | y_size = 0 | |||
| ) | [inline] |
Constructor allows for pre-sizing the array, if desired.
| size_t OpenGUI::AutoArray2D< T >::getSizeX | ( | ) | [inline] |
Get current width of the array.
| size_t OpenGUI::AutoArray2D< T >::getSizeY | ( | ) | [inline] |
Get current height of the array.
| void OpenGUI::AutoArray2D< T >::growSize | ( | size_t | x_size, | |
| size_t | y_size, | |||
| T | value | |||
| ) | [inline] |
Same as previous only allows the values of new entries to be provided via the value argument.
| 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.
| void OpenGUI::AutoArray2D< T >::lock | ( | ) | [inline] |
Locks this array from changing size.
| void OpenGUI::AutoArray2D< T >::resize | ( | size_t | x_size, | |
| size_t | y_size | |||
| ) | [inline] |
Resize the array to the given size.
| void OpenGUI::AutoArray2D< T >::unlock | ( | ) | [inline] |
Unlocks this array so that it can be resized again.