Objective-C++ Preprocessor  5.0 with ARC & GC
C++ classes to enhance syntax and manage reference counting.
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
OOBuffer< ETYPE > Class Template Reference

#include <objvec.h>

Public Member Functions

oo_inline OOBuffer ()
 
oo_inline OOBuffer (NSUInteger size)
 
oo_inline ETYPE & operator[] (NSInteger sub)
 
oo_inline OOBufferoperator= (OOBuffer &from)
 
oo_inline ~OOBuffer ()
 

Public Attributes

NSUInteger used
 
NSUInteger allocated
 
NSUInteger bounds
 

Private Member Functions

void realloc (NSUInteger size)
 

Private Attributes

ETYPE * buff
 

Detailed Description

template<typename ETYPE>
class OOBuffer< ETYPE >

Internal class to allocate storage on demand as it is accessed by ref using the subscript operator. A memory is allocated and reallocated if the element type is a plain type it will be zeroed out otherwise if it is a class the constructor will be called for each element in the array as it is allocated. On reallocation a new oversized array is allocated then the "=" operator used to copy the old values to the new array. This operator should "steal" any deep _refs from the old instance before it is destructed as does the OOBuffer class itself as it is used recursively.

Usage:

 OOBuffer<OOBuffer<double> > x; // not ref counted however
and can not be put into arrays or dictionaries
 x[99][99] = 43;
 

Definition at line 83 of file objvec.h.

Constructor & Destructor Documentation

template<typename ETYPE>
oo_inline OOBuffer< ETYPE >::OOBuffer ( )
inline

Definition at line 105 of file objvec.h.

template<typename ETYPE>
oo_inline OOBuffer< ETYPE >::OOBuffer ( NSUInteger  size)
inline

Definition at line 111 of file objvec.h.

template<typename ETYPE>
oo_inline OOBuffer< ETYPE >::~OOBuffer ( )
inline

Definition at line 143 of file objvec.h.

Member Function Documentation

template<typename ETYPE>
oo_inline OOBuffer& OOBuffer< ETYPE >::operator= ( OOBuffer< ETYPE > &  from)
inline

Definition at line 134 of file objvec.h.

template<typename ETYPE>
oo_inline ETYPE& OOBuffer< ETYPE >::operator[] ( NSInteger  sub)
inline

Definition at line 118 of file objvec.h.

template<typename ETYPE>
void OOBuffer< ETYPE >::realloc ( NSUInteger  size)
inlineprivate

Definition at line 86 of file objvec.h.

Member Data Documentation

template<typename ETYPE>
NSUInteger OOBuffer< ETYPE >::allocated

Definition at line 103 of file objvec.h.

template<typename ETYPE>
NSUInteger OOBuffer< ETYPE >::bounds

Definition at line 103 of file objvec.h.

template<typename ETYPE>
ETYPE* OOBuffer< ETYPE >::buff
private

Definition at line 84 of file objvec.h.

template<typename ETYPE>
NSUInteger OOBuffer< ETYPE >::used

Definition at line 103 of file objvec.h.


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