osgEarth 2.1.1
Public Member Functions | Private Member Functions | Private Attributes

seamless::AutoBuffer< T, N > Class Template Reference

Collaboration diagram for seamless::AutoBuffer< T, N >:

List of all members.

Public Member Functions

 AutoBuffer (int size)
 ~AutoBuffer ()
T & operator[] (int i) const

Private Member Functions

 AutoBuffer (const AutoBuffer &)

Private Attributes

_store [N]
T * _heapStore
T *const _ptr

Detailed Description

template<typename T, int N>
class seamless::AutoBuffer< T, N >

Implements an array that is locally allocated if less than a given size; otherwise, it is allocated on the heap. This is useful if the common case can, for example, easily be allocated on the stack.

Definition at line 31 of file AutoBuffer.


Constructor & Destructor Documentation

template<typename T, int N>
seamless::AutoBuffer< T, N >::AutoBuffer ( int  size) [inline]

Definition at line 34 of file AutoBuffer.

        : _heapStore(size > N ? new T[size] : 0),
          _ptr(size > N ? _heapStore : &_store[0])
    {
    }
template<typename T, int N>
seamless::AutoBuffer< T, N >::~AutoBuffer ( ) [inline]

Definition at line 40 of file AutoBuffer.

    {
        delete [] _heapStore;
    }
template<typename T, int N>
seamless::AutoBuffer< T, N >::AutoBuffer ( const AutoBuffer< T, N > &  ) [private]

Member Function Documentation

template<typename T, int N>
T& seamless::AutoBuffer< T, N >::operator[] ( int  i) const [inline]

Definition at line 45 of file AutoBuffer.

{ return _ptr[i]; }

Member Data Documentation

template<typename T, int N>
T* seamless::AutoBuffer< T, N >::_heapStore [private]

Definition at line 50 of file AutoBuffer.

template<typename T, int N>
T* const seamless::AutoBuffer< T, N >::_ptr [private]

Definition at line 51 of file AutoBuffer.

template<typename T, int N>
T seamless::AutoBuffer< T, N >::_store[N] [private]

Definition at line 49 of file AutoBuffer.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines