Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ucmp32.h File Reference

Go to the source code of this file.

Compounds

struct  CompactIntArray

Typedefs

typedef struct CompactIntArray  CompactIntArray
 class CompactATypeArray : use only on primitive data types Provides a compact way to store information that is indexed by Unicode values, such as character properties, types, keyboard values, etc.This is very useful when you have a block of Unicode data that contains significant values while the rest of the Unicode data is unused in the application or when you have a lot of redundance, such as where all 21,000 Han ideographs have the same value. More...


Functions

U_CAPI int32_t U_EXPORT2 ucmp32_getkUnicodeCount (void)
U_CAPI int32_t U_EXPORT2 ucmp32_getkBlockCount (void)
U_CAPI CompactIntArray* U_EXPORT2 ucmp32_open (int32_t defaultValue)
 Construct an empty CompactIntArray. More...

U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAdopt (uint16_t *indexArray, int32_t *newValues, int32_t count)
 Construct a CompactIntArray from a pre-computed index and values array. More...

U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAlias (uint16_t *indexArray, int32_t *newValues, int32_t count)
U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAdopt (CompactIntArray *this_obj, uint16_t *indexArray, int32_t *newValues, int32_t count)
 Initialize a CompactIntArray from a pre-computed index and values array. More...

U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAlias (CompactIntArray *this_obj, uint16_t *indexArray, int32_t *newValues, int32_t count)
U_CAPI void U_EXPORT2 ucmp32_close (CompactIntArray* array)
U_CAPI UBool U_EXPORT2 ucmp32_isBogus (const CompactIntArray* array)
 Returns TRUE if the creation of the compact array fails.

U_CAPI void U_EXPORT2 ucmp32_set (CompactIntArray *array, UChar character, int32_t value)
 Set a new value for a Unicode character. More...

U_CAPI void U_EXPORT2 ucmp32_setRange (CompactIntArray* array, UChar start, UChar end, int32_t value)
 Set new values for a range of Unicode character. More...

U_CAPI void U_EXPORT2 ucmp32_compact (CompactIntArray* array, int32_t cycle)
 Compact the array. More...

U_CAPI void U_EXPORT2 ucmp32_expand (CompactIntArray* array)
 Expands the compacted array. More...

U_CAPI uint32_t U_EXPORT2 ucmp32_getCount (const CompactIntArray* array)
 Get the number of elements in the value array. More...

U_CAPI const int32_t* U_EXPORT2 ucmp32_getArray (const CompactIntArray* array)
 Get the address of the value array. More...

U_CAPI const uint16_t* U_EXPORT2 ucmp32_getIndex (const CompactIntArray* array)
 Get the address of the index array. More...

U_CAPI void U_EXPORT2 ucmp32_streamIn ( CompactIntArray* array, FileStream* is)
U_CAPI void U_EXPORT2 ucmp32_streamOut (CompactIntArray* array, FileStream* os)
U_CAPI void U_EXPORT2 ucmp32_streamMemIn ( CompactIntArray* array, UMemoryStream* is)
U_CAPI void U_EXPORT2 ucmp32_streamMemOut (CompactIntArray* array, UMemoryStream* os)
U_CAPI uint32_t U_EXPORT2 ucmp32_flattenMem (const CompactIntArray* array, UMemoryStream *MS)
U_CAPI void U_EXPORT2 ucmp32_initFromData (CompactIntArray *this_obj, const uint8_t **source, UErrorCode *status)


Typedef Documentation

typedef struct CompactIntArray CompactIntArray
 

class CompactATypeArray : use only on primitive data types Provides a compact way to store information that is indexed by Unicode values, such as character properties, types, keyboard values, etc.This is very useful when you have a block of Unicode data that contains significant values while the rest of the Unicode data is unused in the application or when you have a lot of redundance, such as where all 21,000 Han ideographs have the same value.

However, lookup is much faster than a hash table.

A compact array of any primitive data type serves two purposes:

  • Fast access of the indexed values.
  • Smaller memory footprint.

The index array always points into particular parts of the data array it is initially set up to point at regular block boundaries The following example uses blocks of 4 for simplicity

 Example: Expanded
 BLOCK  0   1   2   3   4
 INDEX  0   4   8   12  16 ...
 ARRAY  abcdeababcdezyabcdea...
        |   |   |   |   |   |...
 

After compression, the index will point to various places in the data array wherever there is a runs of the same elements as in the original

 Example: Compressed
 BLOCK  0   1   2   3   4
 INDEX  0   4   1   8   2 ...
 ARRAY  abcdeabazyabc...
 

If you look at the example, index number 2 in the expanded version points to data position number 8, which has elements "bcde". In the compressed version, index number 2 points to data position 1, which also has "bcde"

See also:
CompactByteArray , CompactIntArray , CompactCharArray , CompactStringArray
Version:
Revision:
1.14
8/25/98
Author(s):
Helena Shih


Function Documentation

U_CAPI void U_EXPORT2 ucmp32_close ( CompactIntArray * array )
 

U_CAPI void U_EXPORT2 ucmp32_compact ( CompactIntArray * array,
int32_t cycle )
 

Compact the array.

The value of cycle determines how large the overlap can be. A cycle of 1 is the most compacted, but takes the most time to do. If values stored in the array tend to repeat in cycles of, say, 16, then using that will be faster than cycle = 1, and get almost the same compression.

U_CAPI void U_EXPORT2 ucmp32_expand ( CompactIntArray * array )
 

Expands the compacted array.

Takes the array back to a 65536 element array

U_CAPI uint32_t U_EXPORT2 ucmp32_flattenMem ( const CompactIntArray * array,
UMemoryStream * MS )
 

U_CAPI const int32_t *U_EXPORT2 ucmp32_getArray ( const CompactIntArray * array )
 

Get the address of the value array.

Returns:
the address of the value array

U_CAPI uint32_t U_EXPORT2 ucmp32_getCount ( const CompactIntArray * array )
 

Get the number of elements in the value array.

Returns:
the number of elements in the value array.

U_CAPI const uint16_t *U_EXPORT2 ucmp32_getIndex ( const CompactIntArray * array )
 

Get the address of the index array.

Returns:
the address of the index array

U_CAPI int32_t U_EXPORT2 ucmp32_getkBlockCount ( void )
 

U_CAPI int32_t U_EXPORT2 ucmp32_getkUnicodeCount ( void )
 

U_CAPI CompactIntArray *U_EXPORT2 ucmp32_initAdopt ( CompactIntArray * this_obj,
uint16_t * indexArray,
int32_t * newValues,
int32_t count )
 

Initialize a CompactIntArray from a pre-computed index and values array.

The values will be adopted by the CompactIntArray. No memory is allocated. Note: for speed, the compact method will only re-use blocks in the values array that are on a block boundary. The pre-computed arrays passed in to this constructor may re-use blocks at any position in the values array.

Parameters:
indexArray   the index array to be adopted
newValues   the value array to be adopted
count   the number of entries in the value array
See also:
compact

U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAlias ( CompactIntArray * this_obj,
uint16_t * indexArray,
int32_t * newValues,
int32_t count )
 

U_CAPI void U_EXPORT2 ucmp32_initFromData ( CompactIntArray * this_obj,
const uint8_t ** source,
UErrorCode * status )
 

U_CAPI UBool U_EXPORT2 ucmp32_isBogus ( const CompactIntArray * array )
 

Returns TRUE if the creation of the compact array fails.

U_CAPI CompactIntArray *U_EXPORT2 ucmp32_open ( int32_t defaultValue )
 

Construct an empty CompactIntArray.

Parameters:
defaultValue   the default value for all characters not explicitly in the array

U_CAPI CompactIntArray *U_EXPORT2 ucmp32_openAdopt ( uint16_t * indexArray,
int32_t * newValues,
int32_t count )
 

Construct a CompactIntArray from a pre-computed index and values array.

The values will be adopted by the CompactIntArray. Memory is allocated with uprv_malloc. Note: for speed, the compact method will only re-use blocks in the values array that are on a block boundary. The pre-computed arrays passed in to this constructor may re-use blocks at any position in the values array.

Parameters:
indexArray   the index array to be adopted
newValues   the value array to be adopted
count   the number of entries in the value array
See also:
compact

U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAlias ( uint16_t * indexArray,
int32_t * newValues,
int32_t count )
 

U_CAPI void U_EXPORT2 ucmp32_set ( CompactIntArray * array,
UChar character,
int32_t value )
 

Set a new value for a Unicode character.

Set automatically expands the array if it is compacted.

Parameters:
character   the character to set the mapped value with
value   the new mapped value

U_CAPI void U_EXPORT2 ucmp32_setRange ( CompactIntArray * array,
UChar start,
UChar end,
int32_t value )
 

Set new values for a range of Unicode character.

Parameters:
start   the starting offset of the range
end   the ending offset of the range
value   the new mapped value

U_CAPI void U_EXPORT2 ucmp32_streamIn ( CompactIntArray * array,
FileStream * is )
 

U_CAPI void U_EXPORT2 ucmp32_streamMemIn ( CompactIntArray * array,
UMemoryStream * is )
 

U_CAPI void U_EXPORT2 ucmp32_streamMemOut ( CompactIntArray * array,
UMemoryStream * os )
 

U_CAPI void U_EXPORT2 ucmp32_streamOut ( CompactIntArray * array,
FileStream * os )
 


Generated at Tue Dec 5 17:55:44 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000