Foxit PDF Conversion SDK

Public Member Functions | Public Attributes | List of all members
CFX_BaseSegmentedArray Class Reference
FXCRT
Inheritance diagram for CFX_BaseSegmentedArray:

## 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_Allocator * | m_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_size | The specified unit size.
  [in] | segment_units | The count of units in each segment, must be less than 32768.
  [in] | index_size | The number of segments(index levels) in the array, it must be larger than 1 and less than 256.
  [in] | pAllocator | Allocator 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] | index | Specifies the zero-based index of start element in the array to be deleted.
  [in] | count | Specifies 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] | index | Specifies 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_size | The new unit size.
  [in] | segment_units | The new count of units in each segment.
  [in] | index_size | The new number of index levels.

Returns
  None.