PolyVox  0.2.1
Open source voxel management library
Public Member Functions
PolyVox::ArraySizes Class Reference

The ArraySizes class provide a convienient way to specify the dimensions of an Array. More...

#include <ArraySizes.h>

List of all members.

Public Member Functions

 ArraySizes (uint32_t uSize)
 Constructor.
ArraySizesImpl< 2 > operator() (uint32_t uSize)
 Duplicates this object but with an extra dimension.
 operator UIntArray1 () const
 Converts this object to an array of integers.

Detailed Description

The ArraySizes class provide a convienient way to specify the dimensions of an Array.

The Array class requires an array of integers to be passed to the constructor to specify the dimensions of the Array to be built. C++ does not allow this to be done in place, and so it typically requires an extra line of code - something like this:

uint32_t dimensions[3] = {10, 20, 30}; // Array dimensions
Array<3,float> array(dimensions);

The ArraySizes class can be constructed in place, and also provides implicit conversion to an array of integers. Hence it is now possible to declare the above Array as follows:

Array<3,float> array(ArraySizes(10)(20)(30));

Usage of this class is therefore very simple, although the template code behind it may appear complex. For reference, it is based upon the article here: http://www.drdobbs.com/cpp/184401319/

Definition at line 56 of file ArraySizes.h.


Constructor & Destructor Documentation

PolyVox::ArraySizes::ArraySizes ( uint32_t  uSize)
explicit

Constructor.

Parameters:
uSizeThe size of the first dimension.

Definition at line 31 of file ArraySizes.cpp.


Member Function Documentation

PolyVox::ArraySizes::operator UIntArray1 ( ) const

Converts this object to an array of integers.

Returns:
The array of integers corresponding to this object.

Definition at line 51 of file ArraySizes.cpp.

ArraySizesImpl< 2 > PolyVox::ArraySizes::operator() ( uint32_t  uSize)

Duplicates this object but with an extra dimension.

This class only directly implements one dimensional sizes.

Higher numbers of dimensions are implemented via the ArraySisesImpl class. This function create an object of the next dimensionality up.

Parameters:
uSizeThe size of the next dimension.
Returns:
A higher dimension version of this class.

Definition at line 43 of file ArraySizes.cpp.


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