CFX_SegmentedArray< ElementType > Class Template Reference
Inheritance diagram for CFX_SegmentedArray< ElementType >:
CFX_BaseSegmentedArray

Public Member Functions

 CFX_SegmentedArray (int segment_units, int index_size=8, IFX_Allocator *pAllocator=0)
 Construct with specified segment units. More...
 
void Add (ElementType data)
 Add an element. More...
 
ElementType & operator[] (int index)
 Subscript([]) operator overload. This function returns a ref to the specified element specified by the zero-based index. More...
 
- Public Member Functions inherited from CFX_BaseSegmentedArray
 CFX_BaseSegmentedArray (int unit_size=1, int segment_units=512, int index_size=8, IFX_Allocator *pAllocator=0)
 Construct with specified unit size, segment units, and number of index levels. More...
 
 ~CFX_BaseSegmentedArray ()
 The destructor.
 
void * Add ()
 Add an element. More...
 
void Delete (int index, int count=1)
 Delete a number of elements. More...
 
void * GetAt (int index) const
 Get a typeless pointer to an element data. More...
 
int GetSegmentSize () const
 Get number of elements in each segment. More...
 
int GetSize () const
 Get number of elements in the array. More...
 
int GetUnitSize () const
 Get number of bytes for each element. More...
 
void * Iterate (FX_BOOL(*callback)(void *param, void *pData), void *param) const
 Iterate all units, with a callback function for each unit. More...
 
void RemoveAll ()
 Remove all elements in the array. More...
 
void SetUnitSize (int unit_size, int segment_units, int index_size=8)
 Change the unit size and the segment units. This can only be called when array is empty. More...
 

Additional Inherited Members

- Public Attributes inherited from CFX_BaseSegmentedArray
IFX_Allocatorm_pAllocator
 Special allocator pointer. NULL means to use default allocator.
 

Detailed Description

template<class ElementType>
class CFX_SegmentedArray< ElementType >

The class represents grow-able array template with allocation in segments.

Constructor & Destructor Documentation

◆ CFX_SegmentedArray()

template<class ElementType >
CFX_SegmentedArray< ElementType >::CFX_SegmentedArray ( int  segment_units,
int  index_size = 8,
IFX_Allocator pAllocator = 0 
)
inline

Construct with specified segment units.

Parameters
[in]segment_unitsThe count of units in each segment.
[in]index_sizeThe number of segments in the array. Default value: 8.
[in]pAllocatorAn allocator. Default value: NULL.

Member Function Documentation

◆ Add()

template<class ElementType >
void CFX_SegmentedArray< ElementType >::Add ( ElementType  data)
inline

Add an element.

Parameters
[in]dataThe input element.
Returns
None.

◆ operator[]()

template<class ElementType >
ElementType& CFX_SegmentedArray< ElementType >::operator[] ( int  index)
inline

Subscript([]) operator overload. This function returns a ref to the specified element specified by the zero-based index.

Parameters
[in]indexSpecifies the zero-based index in the array.
Returns
A reference to the specified element.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.