Foxit PDF Conversion SDK
CFX_BaseSegmentedArray Class Reference
Inheritance diagram for CFX_BaseSegmentedArray:
CFX_SegmentedArray< ElementType >

Public Member Functions

 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...
 

Public Attributes

IFX_Allocatorm_pAllocator
 Special allocator pointer. NULL means to use default allocator.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ CFX_BaseSegmentedArray()

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.

Parameters
[in]unit_sizeThe specified unit size.
[in]segment_unitsThe count of units in each segment, must be less than 32768.
[in]index_sizeThe number of segments(index levels) in the array, it must be larger than 1 and less than 256.
[in]pAllocatorAllocator used in this class. NULL to use default allocator.

Member Function Documentation

◆ Add()

void* CFX_BaseSegmentedArray::Add ( )

Add an element.

Returns
The typeless pointer to the added element.

◆ Delete()

void CFX_BaseSegmentedArray::Delete ( int  index,
int  count = 1 
)

Delete a number of elements.

Parameters
[in]indexSpecifies the zero-based index of start element in the array to be deleted.
[in]countSpecifies the count of element to delete.
Returns
None.

◆ GetAt()

void* CFX_BaseSegmentedArray::GetAt ( int  index) const

Get a typeless pointer to an element data.

Parameters
[in]indexSpecifies the zero-based index of element.
Returns
A typeless pointer to the element data.

◆ GetSegmentSize()

int CFX_BaseSegmentedArray::GetSegmentSize ( ) const
inline

Get number of elements in each segment.

Returns
The number of elements in each segment.

◆ GetSize()

int CFX_BaseSegmentedArray::GetSize ( ) const
inline

Get number of elements in the array.

Returns
The number of elements in the array.

◆ GetUnitSize()

int CFX_BaseSegmentedArray::GetUnitSize ( ) const
inline

Get number of bytes for each element.

Returns
The number of bytes for each element.

◆ Iterate()

void* CFX_BaseSegmentedArray::Iterate ( FX_BOOL(*)(void *param, void *pData)  callback,
void *  param 
) const

Iterate all units, with a callback function for each unit.

Parameters
[in]callback
[in]param
Returns
The current unit when stopped, or NULL when all units iterated.

◆ RemoveAll()

void CFX_BaseSegmentedArray::RemoveAll ( )

Remove all elements in the array.

Returns
None.

◆ SetUnitSize()

void CFX_BaseSegmentedArray::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.

Parameters
[in]unit_sizeThe new unit size.
[in]segment_unitsThe new count of units in each segment.
[in]index_sizeThe new number of index levels.
Returns
None.