ajtable.c
Datatypes: AjPTable
Hash tables
Sections: Constructors Destructors Retrieval Trace functions Adding values Map function to each value Modify Merging exit
Constructors for hash tables
Functions: ajTableNew ajTableNewFunctionLen
creates, initialises, and returns a new, empty table that expects
a specified number of key-value pairs.
Current method defines the table size as the number of entries divided by 4
to avoid a huge table.
Synopsis
Prototype
AjPTable ajTableNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | number of key-value pairs |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | number of key-value pairs |
Returns
Description
creates, initialises, and returns a new, empty table that expects
a specified number of key-value pairs.
Current method defines the table size as the number of entries divided by 4
to avoid a huge table.
See Also
See other functions in this section
Availability
In release 6.4.0
creates, initialises, and returns a new, empty table that expects
a specified number of key-value pairs.
Current method defines the table size as the number of entries divided by 4
to avoid a huge table.
Synopsis
Prototype
AjPTable ajTableNewFunctionLen (
ajuint size,
ajint function cmp,
ajuint function hash,
void function keydel,
void function valdel
);
Type | Name | Read/Write | Description |
ajuint | size | Input | number of key-value pairs |
ajint function | cmp | Function | function for comparing |
ajuint function | hash | Function | function for hashing keys |
void function | keydel | Function | key destructor function |
void function | valdel | Function | value destructor function |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | number of key-value pairs |
cmp: | (Function) | function for comparing |
hash: | (Function) | function for hashing keys |
keydel: | (Function) | key destructor function |
valdel: | (Function) | value destructor function |
Returns
Description
creates, initialises, and returns a new, empty table that expects
a specified number of key-value pairs.
Current method defines the table size as the number of entries divided by 4
to avoid a huge table.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableDel ajTableDelKeydelValdel ajTableDelValdel ajTableFree
Deallocates and clears a hash table, and any keys or values.
Synopsis
Prototype
void ajTableDel (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table (by reference) |
void | | RETURN | |
Output
Ptable: | (Delete) | Table (by reference) |
Returns
Description
Deallocates and clears a hash table, and any keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Deallocates and clears a hash table, and any keys or values.
Synopsis
Prototype
void ajTableDelKeydelValdel (
AjPTable* Ptable,
void function keydel,
void function valdel
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table (by reference) |
void function | keydel | Function | key destructor |
void function | valdel | Function | value destructor |
void | | RETURN | |
Input
keydel: | (Function) | key destructor |
valdel: | (Function) | value destructor |
Output
Ptable: | (Delete) | Table (by reference) |
Returns
Description
Deallocates and clears a hash table, and any keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Deallocates and clears a hash table, and any keys or values.
Synopsis
Prototype
void ajTableDelValdel (
AjPTable* Ptable,
void function valdel
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table (by reference) |
void function | valdel | Function | value destructor |
void | | RETURN | |
Input
valdel: | (Function) | value destructor |
Output
Ptable: | (Delete) | Table (by reference) |
Returns
Description
Deallocates and clears a hash table, and any keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Deallocates and clears a hash table. Does not clear keys or values.
Synopsis
Prototype
void ajTableFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table (by reference) |
void | | RETURN | |
Output
Ptable: | (Delete) | Table (by reference) |
Returns
Description
Deallocates and clears a hash table. Does not clear keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableFetchC ajTableFetchS ajTableFetchV ajTableFetchmodC ajTableFetchmodS ajTableFetchmodV ajTableFetchmodTraceV ajTableGetLength ajTableGetSize ajTableMatchC ajTableMatchS ajTableMatchV ajTableToarrayKeys ajTableToarrayKeysValues ajTableToarrayValues
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const void* ajTableFetchC (
const AjPTable table,
const char* txtkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const char* | txtkey | Input | key to find. |
const void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
txtkey: | (Input) | key to find. |
Returns
const void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const void* ajTableFetchS (
const AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const AjPStr | key | Input | key to find. |
const void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
const void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const void* ajTableFetchV (
const AjPTable table,
const void* key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const void* | key | Input | key to find. |
const void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
const void*: | value associated with key |
Description
Returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
void* ajTableFetchmodC (
const AjPTable table,
const char* txtkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const char* | txtkey | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
txtkey: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
void* ajTableFetchmodS (
const AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const AjPStr | key | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
void* ajTableFetchmodV (
const AjPTable table,
const void* key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const void* | key | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
Returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the value associated with key in table, or null
if table does not hold key.
Trace internals with debug calls.
Synopsis
Prototype
void* ajTableFetchmodTraceV (
const AjPTable table,
const void* key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const void* | key | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
Returns the value associated with key in table, or null
if table does not hold key.
Trace internals with debug calls.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the number of key-value pairs in table.
Synopsis
Prototype
ajuint ajTableGetLength (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table to be applied. |
ajuint | | RETURN | number of key-value pairs. |
Input
table: | (Input) | Table to be applied. |
Returns
ajuint: | number of key-value pairs. |
Description
returns the number of key-value pairs in table.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the size of the hash array in a table.
Synopsis
Prototype
ajuint ajTableGetSize (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table to be applied. |
ajuint | | RETURN | number of hash array positions |
Input
table: | (Input) | Table to be applied. |
Returns
ajuint: | number of hash array positions |
Description
returns the size of the hash array in a table.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
Synopsis
Prototype
AjBool ajTableMatchC (
const AjPTable table,
const char* txtkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const char* | txtkey | Input | key to find. |
AjBool | | RETURN | True if key was found[ |
Input
table: | (Input) | table to search |
txtkey: | (Input) | key to find. |
Returns
AjBool: | True if key was found[ |
Description
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
See Also
See other functions in this section
Availability
In release 6.4.0
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
Synopsis
Prototype
AjBool ajTableMatchS (
const AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const AjPStr | key | Input | key to find. |
AjBool | | RETURN | True if key was found |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
AjBool: | True if key was found |
Description
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
See Also
See other functions in this section
Availability
In release 6.4.0
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
Synopsis
Prototype
AjBool ajTableMatchV (
const AjPTable table,
const void* key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const void* | key | Input | key to find. |
AjBool | | RETURN | True if key was found |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
AjBool: | True if key was found |
Description
Returns true if the key is found in the table
Used in place of ajTableFetchS where the value may be NULL
See Also
See other functions in this section
Availability
In release 6.4.0
creates two N+1 element arrays that holds the N keys
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
Synopsis
Prototype
ajuint ajTableToarrayKeys (
const AjPTable table,
void*** keyarray
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void*** | keyarray | Output | NULL terminated array of keys. |
ajuint | | RETURN | size of array returned |
Input
Output
keyarray: | (Output) | NULL terminated array of keys. |
Returns
ajuint: | size of array returned |
Description
creates two N+1 element arrays that holds the N keys
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
See Also
See other functions in this section
Availability
In release 6.4.0
creates two N+1 element arrays that holds the N key-value pairs
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
Synopsis
Prototype
ajuint ajTableToarrayKeysValues (
const AjPTable table,
void*** keyarray,
void*** valarray
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void*** | keyarray | Output | NULL terminated array of keys. |
void*** | valarray | Output | NULL terminated array of values. |
ajuint | | RETURN | size of arrays returned |
Input
Output
keyarray: | (Output) | NULL terminated array of keys. |
valarray: | (Output) | NULL terminated array of values. |
Returns
ajuint: | size of arrays returned |
Description
creates two N+1 element arrays that holds the N key-value pairs
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
See Also
See other functions in this section
Availability
In release 6.4.0
creates two N+1 element arrays that holds the N values
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
Synopsis
Prototype
ajuint ajTableToarrayValues (
const AjPTable table,
void*** valarray
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void*** | valarray | Output | NULL terminated array of values. |
ajuint | | RETURN | size of array returned |
Input
Output
valarray: | (Output) | NULL terminated array of values. |
Returns
ajuint: | size of array returned |
Description
creates two N+1 element arrays that holds the N values
in table in an unspecified order and returns the number of elements.
The final element of the array is NULL.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableTrace
Writes debug messages to trace the contents of a table.
Synopsis
Prototype
void ajTableTrace (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void | | RETURN | |
Input
Returns
Description
Writes debug messages to trace the contents of a table.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablePut ajTablePutClean ajTablePutTrace ajTableRemove ajTableRemoveKey
change the value associated with key in table to value and returns
the previous value, or adds key and value if table does not hold key,
and returns null.
Synopsis
Prototype
void* ajTablePut (
AjPTable table,
void* key,
void* value
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table to add to |
void* | key | Unknown | key |
void* | value | Modify | value of key |
void* | | RETURN | previous value if key exists, NULL if not. |
Input & Output
table: | (Modify) | Table to add to |
value: | (Modify) | value of key |
Returns
void*: | previous value if key exists, NULL if not. |
Description
change the value associated with key in table to value and returns
the previous value, or adds key and value if table does not hold key,
and returns null.
See Also
See other functions in this section
Availability
In release 6.4.0
change the value associated with key in table to value and returns
the previous value, applying destructors to the given key and value,
or adds key and value if table does not hold key,
and returns null.
Synopsis
Prototype
AjBool ajTablePutClean (
AjPTable table,
void* key,
void* value,
void function keydel,
void function valdel
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table to add to |
void* | key | Unknown | key |
void* | value | Modify | value of key |
void function | keydel | Function | key destructor |
void function | valdel | Function | value destructor |
AjBool | | RETURN | previous value was found and deleted. |
Input
keydel: | (Function) | key destructor |
valdel: | (Function) | value destructor |
Input & Output
table: | (Modify) | Table to add to |
value: | (Modify) | value of key |
Returns
AjBool: | previous value was found and deleted. |
Description
change the value associated with key in table to value and returns
the previous value, applying destructors to the given key and value,
or adds key and value if table does not hold key,
and returns null.
See Also
See other functions in this section
Availability
In release 6.4.0
change the value associated with key in table to value and returns
the previous value, or adds key and value if table does not hold key,
and returns null. Trace the internals as the value is inserted.
Synopsis
Prototype
void* ajTablePutTrace (
AjPTable table,
void* key,
void* value
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table to add to |
void* | key | Unknown | key |
void* | value | Modify | value of key |
void* | | RETURN | previous value if key exists, NULL if not. |
Input & Output
table: | (Modify) | Table to add to |
value: | (Modify) | value of key |
Returns
void*: | previous value if key exists, NULL if not. |
Description
change the value associated with key in table to value and returns
the previous value, or adds key and value if table does not hold key,
and returns null. Trace the internals as the value is inserted.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes the key-value pair from table and returns the removed
value. If table does not hold key, ajTableRemove has no effect
and returns null.
Synopsis
Prototype
void* ajTableRemove (
AjPTable table,
const void* key
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
const void* | key | Input | key to be removed |
void* | | RETURN | removed value. |
Input
key: | (Input) | key to be removed |
Input & Output
Returns
Description
Removes the key-value pair from table and returns the removed
value. If table does not hold key, ajTableRemove has no effect
and returns null.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes the key-value pair from table and returns the removed
value. If table does not hold key, ajTableRemove has no effect
and returns null.
Synopsis
Prototype
void* ajTableRemoveKey (
AjPTable table,
const void* key,
void** truekey
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
const void* | key | Input | key to be removed |
void** | truekey | Output | true internal key returned, now owned by caller |
void* | | RETURN | removed value. |
Input
key: | (Input) | key to be removed |
Output
truekey: | (Output) | true internal key returned, now owned by caller |
Input & Output
Returns
Description
Removes the key-value pair from table and returns the removed
value. If table does not hold key, ajTableRemove has no effect
and returns null.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableMap ajTableMapDel
calls function 'apply' for each key-value in table
in an unspecified order. The table keys should not be modified by
function 'apply' although values can be updated.
See ajTableMapDel for a function that can delete.
Note: because of the properties of C it is difficult to check these
are being called correctly. This is because the apply function
uses void* arguments.
Synopsis
Prototype
void ajTableMap (
AjPTable table,
void function apply,
void* cl
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table. |
void function | apply | Function | function to be applied |
void* | cl | Modify | Standard. Usually NULL. To be passed to apply |
void | | RETURN | |
Input
apply: | (Function) | function to be applied |
Input & Output
table: | (Modify) | Table. |
cl: | (Modify) | Standard. Usually NULL. To be passed to apply |
Returns
Description
calls function 'apply' for each key-value in table
in an unspecified order. The table keys should not be modified by
function 'apply' although values can be updated.
See ajTableMapDel for a function that can delete.
Note: because of the properties of C it is difficult to check these
are being called correctly. This is because the apply function
uses void* arguments.
See Also
See other functions in this section
Availability
In release 6.4.0
calls function 'apply' for each key-value in table
in an unspecified order.
Keys in the table can be deleted - for example a function to delete
a table entry. See ajTableMap for a function that is read-only
Synopsis
Prototype
void ajTableMapDel (
AjPTable table,
void function apply,
void* cl
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table. |
void function | apply | Function | function to be applied |
void* | cl | Modify | Standard. Usually NULL. To be passed to apply |
void | | RETURN | |
Input
apply: | (Function) | function to be applied |
Input & Output
table: | (Modify) | Table. |
cl: | (Modify) | Standard. Usually NULL. To be passed to apply |
Returns
Description
calls function 'apply' for each key-value in table
in an unspecified order.
Keys in the table can be deleted - for example a function to delete
a table entry. See ajTableMap for a function that is read-only
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableClear ajTableClearDelete ajTableResizeCount ajTableResizeHashsize ajTableSetDestroy ajTableSetDestroyboth ajTableSetDestroykey ajTableSetDestroyvalue ajTableSettypeChar ajTableSettypeCharCase ajTableSettypeDefault ajTableSettypeInt ajTableSettypeLong ajTableSettypeString ajTableSettypeStringCase ajTableSettypeUint ajTableSettypeUlong ajTableSettypeUser
Clears a hash table. Does not clear keys or values.
Synopsis
Prototype
void ajTableClear (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void | | RETURN | |
Input & Output
Returns
Description
Clears a hash table. Does not clear keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Clears a hash table. Deletes all keys or values.
Synopsis
Prototype
void ajTableClearDelete (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void | | RETURN | |
Input & Output
Returns
Description
Clears a hash table. Deletes all keys or values.
See Also
See other functions in this section
Availability
In release 6.4.0
Resizes a hash table to a new number of expected values.
Synopsis
Prototype
void ajTableResizeCount (
AjPTable table,
ajuint size
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
ajuint | size | Input | Expected number of key-value pairs |
void | | RETURN | |
Input
size: | (Input) | Expected number of key-value pairs |
Input & Output
Returns
Description
Resizes a hash table to a new number of expected values.
See Also
See other functions in this section
Availability
In release 6.4.0
Resizes a hash table to a new size.
Synopsis
Prototype
void ajTableResizeHashsize (
AjPTable table,
ajuint hashsize
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
ajuint | hashsize | Input | Expected number of key-value pairs |
void | | RETURN | |
Input
hashsize: | (Input) | Expected number of key-value pairs |
Input & Output
Returns
Description
Resizes a hash table to a new size.
See Also
See other functions in this section
Availability
In release 6.4.0
Sets the destructor functions for keys and values
Synopsis
Prototype
void ajTableSetDestroy (
AjPTable table,
void function keydel,
void function valdel
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void function | keydel | Function | key destructor function |
void function | valdel | Function | value destructor function |
void | | RETURN | |
Input
keydel: | (Function) | key destructor function |
valdel: | (Function) | value destructor function |
Input & Output
Returns
Description
Sets the destructor functions for keys and values
See Also
See other functions in this section
Availability
In release 6.4.0
Sets the destructor functions values to be the same as for keys
Synopsis
Prototype
void ajTableSetDestroyboth (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void | | RETURN | |
Input & Output
Returns
Description
Sets the destructor functions values to be the same as for keys
See Also
See other functions in this section
Availability
In release 6.4.0
Sets the destructor functions for keys
Synopsis
Prototype
void ajTableSetDestroykey (
AjPTable table,
void function keydel
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void function | keydel | Function | key destructor function |
void | | RETURN | |
Input
keydel: | (Function) | key destructor function |
Input & Output
Returns
Description
Sets the destructor functions for keys
See Also
See other functions in this section
Availability
In release 6.4.0
Sets the destructor functions for values
Synopsis
Prototype
void ajTableSetDestroyvalue (
AjPTable table,
void function valdel
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Table |
void function | valdel | Function | value destructor function |
void | | RETURN | |
Input
valdel: | (Function) | value destructor function |
Input & Output
Returns
Description
Sets the destructor functions for values
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use C character string keys
Synopsis
Prototype
void ajTableSettypeChar (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use C character string keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use case-insensitive C character string keys
Synopsis
Prototype
void ajTableSettypeCharCase (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use case-insensitive C character string keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use default keys
Synopsis
Prototype
void ajTableSettypeDefault (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use default keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use integer keys
Synopsis
Prototype
void ajTableSettypeInt (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use integer keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use long integer keys
Synopsis
Prototype
void ajTableSettypeLong (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use long integer keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use string keys
Synopsis
Prototype
void ajTableSettypeString (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use string keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use case-insensitive string keys
Synopsis
Prototype
void ajTableSettypeStringCase (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use case-insensitive string keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use unsigned integer keys
Synopsis
Prototype
void ajTableSettypeUint (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use unsigned integer keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use unsigned long integer keys
Synopsis
Prototype
void ajTableSettypeUlong (
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
void | | RETURN | |
Input & Output
Returns
Description
Resets a hash table to use unsigned long integer keys
See Also
See other functions in this section
Availability
In release 6.4.0
Resets a hash table to use user-defined keys
Synopsis
Prototype
void ajTableSettypeUser (
AjPTable table,
ajint function cmp,
ajuint function hash
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | Hash table |
ajint function | cmp | Function | function for comparing |
ajuint function | hash | Function | function for hashing keys |
void | | RETURN | |
Input
cmp: | (Function) | function for comparing |
hash: | (Function) | function for hashing keys |
Input & Output
Returns
Description
Resets a hash table to use user-defined keys
See Also
See other functions in this section
Availability
In release 6.4.0
Merging two tables with matchng key and value types
Functions: ajTableMergeAnd ajTableMergeEor ajTableMergeNot ajTableMergeOr
Merge two tables, keeping all keys that are in both tables
Synopsis
Prototype
AjBool ajTableMergeAnd (
AjPTable thys,
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | thys | Modify | Current table |
AjPTable | table | Modify | Table to be merged |
AjBool | | RETURN | True on success |
Input & Output
thys: | (Modify) | Current table |
table: | (Modify) | Table to be merged |
Returns
Description
Merge two tables, keeping all keys that are in both tables
See Also
See other functions in this section
Availability
In release 6.4.0
Merge two tables, keeping all keys that are in only one table
Synopsis
Prototype
AjBool ajTableMergeEor (
AjPTable thys,
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | thys | Modify | Current table |
AjPTable | table | Modify | Table to be merged |
AjBool | | RETURN | True on success |
Input & Output
thys: | (Modify) | Current table |
table: | (Modify) | Table to be merged |
Returns
Description
Merge two tables, keeping all keys that are in only one table
See Also
See other functions in this section
Availability
In release 6.4.0
Merge two tables, removing all keys that are not in the new table
Synopsis
Prototype
AjBool ajTableMergeNot (
AjPTable thys,
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | thys | Modify | Current table |
AjPTable | table | Modify | Table to be merged |
AjBool | | RETURN | True on success |
Input & Output
thys: | (Modify) | Current table |
table: | (Modify) | Table to be merged |
Returns
Description
Merge two tables, removing all keys that are not in the new table
See Also
See other functions in this section
Availability
In release 6.4.0
Merge two tables, adding all unique keys from the new table
Synopsis
Prototype
AjBool ajTableMergeOr (
AjPTable thys,
AjPTable table
);
Type | Name | Read/Write | Description |
AjPTable | thys | Modify | Current table |
AjPTable | table | Modify | Table to be merged |
AjBool | | RETURN | True on success |
Input & Output
thys: | (Modify) | Current table |
table: | (Modify) | Table to be merged |
Returns
Description
Merge two tables, adding all unique keys from the new table
See Also
See other functions in this section
Availability
In release 6.4.0
Functions called on exit from the program by ajExit to do
any necessary cleanup and to report internal statistics to the debug file
Functions: ajTableExit
Prints a summary of table usage with debug calls
Synopsis
Prototype
void ajTableExit (
void
);
Type | Name | Read/Write | Description |
void | | RETURN | |
Returns
Description
Prints a summary of table usage with debug calls
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTablecharNew ajTablecharNewCase ajTablecharNewCaseConst ajTablecharNewConst
Creates a table with a character string key.
Synopsis
Prototype
AjPTable ajTablecharNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | number of key-value pairs |
AjPTable | | RETURN | New table object with a character string key. |
Input
size: | (Input) | number of key-value pairs |
Returns
AjPTable: | New table object with a character string key. |
Description
Creates a table with a character string key.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates a table with a character string key and case insensitive searching.
Synopsis
Prototype
AjPTable ajTablecharNewCase (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | Hash size estimate. |
AjPTable | | RETURN | New table object with a character string key. |
Input
size: | (Input) | Hash size estimate. |
Returns
AjPTable: | New table object with a character string key. |
Description
Creates a table with a character string key and case insensitive searching.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates a table with a character string key and case insensitive searching.
Synopsis
Prototype
AjPTable ajTablecharNewCaseConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | Hash size estimate. |
AjPTable | | RETURN | New table object with a character string key. |
Input
size: | (Input) | Hash size estimate. |
Returns
AjPTable: | New table object with a character string key. |
Description
Creates a table with a character string key and case insensitive searching.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates a table with a character string key.
Synopsis
Prototype
AjPTable ajTablecharNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | number of key-value pairs |
AjPTable | | RETURN | New table object with a character string key. |
Input
size: | (Input) | number of key-value pairs |
Returns
AjPTable: | New table object with a character string key. |
Description
Creates a table with a character string key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablecharPrint
Print function for a table with a character string key.
Synopsis
Prototype
void ajTablecharPrint (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table. |
void | | RETURN | |
Input
Returns
Description
Print function for a table with a character string key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablecharCmp ajTablecharCmpCase ajTablecharHash ajTablecharHashCase
Comparison function for a table with a character string key
Synopsis
Prototype
ajint ajTablecharCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with a character string key
See Also
See other functions in this section
Availability
In release 6.4.0
Comparison function for a table with a character string key
and case insensitivity.
Synopsis
Prototype
ajint ajTablecharCmpCase (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with a character string key
and case insensitivity.
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with a character string key
Synopsis
Prototype
ajuint ajTablecharHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value. |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
Description
Hash function for a table with a character string key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with a character string key and
case insensitivity.
Synopsis
Prototype
ajuint ajTablecharHashCase (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value. |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
Description
Hash function for a table with a character string key and
case insensitivity.
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTableintNew ajTableintNewConst
Creates, initialises, and returns a new, empty table that can hold a
specified number of integer key-value pairs.
Synopsis
Prototype
AjPTable ajTableintNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of integer key-value pairs.
Synopsis
Prototype
AjPTable ajTableintNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableintFree ajTableintFreeKey
Free keys and value strings in a table and free the table. Use
only where the keys and data in the table are real, and not just
copies of pointers. Otherwise a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableintFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table. Use
only where the keys and data in the table are real, and not just
copies of pointers. Otherwise a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableintFreeKey (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableintFetch
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const ajint* ajTableintFetch (
const AjPTable table,
const ajint* intkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const ajint* | intkey | Input | key to find. |
const ajint* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
intkey: | (Input) | key to find. |
Returns
const ajint*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableintFetchmod
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
ajint* ajTableintFetchmod (
AjPTable table,
const ajint* intkey
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | table to search |
const ajint* | intkey | Input | key to find. |
ajint* | | RETURN | value associated with key |
Input
intkey: | (Input) | key to find. |
Input & Output
table: | (Modify) | table to search |
Returns
ajint*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableintCmp ajTableintHash
Comparison function for a table with an integer key
Synopsis
Prototype
ajint ajTableintCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with an integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with an integer key
Synopsis
Prototype
ajuint ajTableintHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with an integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTablelongNew ajTablelongNewConst
Creates, initialises, and returns a new, empty table that can hold a
specified number of long integer key-value pairs.
Synopsis
Prototype
AjPTable ajTablelongNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of long integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of long integer key-value pairs.
Synopsis
Prototype
AjPTable ajTablelongNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of long integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablelongFree ajTablelongFreeKey
Free keys and value strings in a table and free the table. Use
only where the keys and data in the table are real, and not just
copies of pointers. Otherwise a call to ajTableFree is enough.
Synopsis
Prototype
void ajTablelongFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table. Use
only where the keys and data in the table are real, and not just
copies of pointers. Otherwise a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Free keys and value strings in a table and free the table. Use
only where the keys in the table are real, and not just copies of
pointers. Otherwise a call to ajTableFree is enough.
Synopsis
Prototype
void ajTablelongFreeKey (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table. Use
only where the keys in the table are real, and not just copies of
pointers. Otherwise a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablelongFetch
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const ajlong* ajTablelongFetch (
const AjPTable table,
const ajlong* longkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const ajlong* | longkey | Input | key to find. |
const ajlong* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
longkey: | (Input) | key to find. |
Returns
const ajlong*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablelongFetchmod
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
ajlong* ajTablelongFetchmod (
AjPTable table,
const ajlong* longkey
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | table to search |
const ajlong* | longkey | Input | key to find. |
ajlong* | | RETURN | value associated with key |
Input
longkey: | (Input) | key to find. |
Input & Output
table: | (Modify) | table to search |
Returns
ajlong*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablelongCmp ajTablelongHash
Comparison function for a table with a long integer key
Synopsis
Prototype
ajint ajTablelongCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with a long integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with a long integer key
Synopsis
Prototype
ajuint ajTablelongHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with a long integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTablestrNew ajTablestrNewCase ajTablestrNewCaseConst ajTablestrNewConst
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
Synopsis
Prototype
AjPTable ajTablestrNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
Synopsis
Prototype
AjPTable ajTablestrNewCase (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
Synopsis
Prototype
AjPTable ajTablestrNewCaseConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
Synopsis
Prototype
AjPTable ajTablestrNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablestrFree ajTablestrFreeKey
Free keys and value strings in a table and free the table.
Use only where the keys and strings
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTablestrFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys and strings
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Free string keys in a table and free the table. Do not free the values.
Use only where the keys
in the table are real strings, and not just copies of pointers. Otherwise
a call to ajTableFree is enough. The data is simply freed.
Synopsis
Prototype
void ajTablestrFreeKey (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free string keys in a table and free the table. Do not free the values.
Use only where the keys
in the table are real strings, and not just copies of pointers. Otherwise
a call to ajTableFree is enough. The data is simply freed.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablestrFetchC ajTablestrFetchS ajTablestrFetchkeyC ajTablestrFetchkeyS
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
void* ajTablestrFetchC (
const AjPTable table,
const char* txtkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const char* | txtkey | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
txtkey: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
void* ajTablestrFetchS (
const AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const AjPStr | key | Input | key to find. |
void* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
void*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
returns the key value associated with key in table, or null
if table does not hold key.
Intended for case-insensitive keys, to return the true key
Synopsis
Prototype
const AjPStr ajTablestrFetchkeyC (
const AjPTable table,
const char* txtkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const char* | txtkey | Input | key to find. |
const AjPStr | | RETURN | key value as stored in the table |
Input
table: | (Input) | table to search |
txtkey: | (Input) | key to find. |
Returns
const AjPStr: | key value as stored in the table |
Description
returns the key value associated with key in table, or null
if table does not hold key.
Intended for case-insensitive keys, to return the true key
See Also
See other functions in this section
Availability
In release 6.4.0
returns the key value associated with key in table, or null
if table does not hold key.
Intended for case-insensitive keys, to return the true key
Synopsis
Prototype
const AjPStr ajTablestrFetchkeyS (
const AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const AjPStr | key | Input | key to find. |
const AjPStr | | RETURN | key value as stored in the table |
Input
table: | (Input) | table to search |
key: | (Input) | key to find. |
Returns
const AjPStr: | key value as stored in the table |
Description
returns the key value associated with key in table, or null
if table does not hold key.
Intended for case-insensitive keys, to return the true key
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablestrFetchmod
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
AjPStr* ajTablestrFetchmod (
AjPTable table,
const AjPStr key
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | table to search |
const AjPStr | key | Input | key to find. |
AjPStr* | | RETURN | value associated with key |
Input
Input & Output
table: | (Modify) | table to search |
Returns
AjPStr*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablestrCmp ajTablestrCmpCase ajTablestrHash ajTablestrHashCase
Comparison function for a table with a string key
Synopsis
Prototype
ajint ajTablestrCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with a string key
See Also
See other functions in this section
Availability
In release 6.4.0
Comparison function for a table with a string key
and case insensitivity.
Synopsis
Prototype
ajint ajTablestrCmpCase (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with a string key
and case insensitivity.
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with a string key
Synopsis
Prototype
ajuint ajTablestrHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with a string key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with a string key and
case insensitivity.
Synopsis
Prototype
ajuint ajTablestrHashCase (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with a string key and
case insensitivity.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTablestrPrint ajTablestrTrace ajTablestrTracekeys
Print function for a table with a string key.
Synopsis
Prototype
void ajTablestrPrint (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table. |
void | | RETURN | |
Input
Returns
Description
Print function for a table with a string key.
See Also
See other functions in this section
Availability
In release 6.4.0
Writes debug messages to trace the contents of a table,
assuming all keys and values are strings.
Synopsis
Prototype
void ajTablestrTrace (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void | | RETURN | |
Input
Returns
Description
Writes debug messages to trace the contents of a table,
assuming all keys and values are strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Writes debug messages to trace the keys of a string table,
assuming all keys and values are strings.
Synopsis
Prototype
void ajTablestrTracekeys (
const AjPTable table
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | Table |
void | | RETURN | |
Input
Returns
Description
Writes debug messages to trace the keys of a string table,
assuming all keys and values are strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTableuintNew ajTableuintNewConst
Creates, initialises, and returns a new, empty table that can hold a
specified number of unsigned integer key-value pairs.
Synopsis
Prototype
AjPTable ajTableuintNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of unsigned integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold a
specified number of unsigned integer key-value pairs.
Synopsis
Prototype
AjPTable ajTableuintNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold a
specified number of unsigned integer key-value pairs.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableuintFree ajTableuintFreeKey
Free keys and value strings in a table and free the table.
Use only where the keys and data
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableuintFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys and data
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableuintFreeKey (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableuintFetch
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const ajuint* ajTableuintFetch (
const AjPTable table,
const ajuint* uintkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const ajuint* | uintkey | Input | key to find. |
const ajuint* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
uintkey: | (Input) | key to find. |
Returns
const ajuint*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableuintFetchmod
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
ajuint* ajTableuintFetchmod (
AjPTable table,
const ajuint* uintkey
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | table to search |
const ajuint* | uintkey | Input | key to find. |
ajuint* | | RETURN | value associated with key |
Input
uintkey: | (Input) | key to find. |
Input & Output
table: | (Modify) | table to search |
Returns
ajuint*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableuintCmp ajTableuintHash
Comparison function for a table with an unsigned integer key
Synopsis
Prototype
ajint ajTableuintCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with an unsigned integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with an unsigned integer key
Synopsis
Prototype
ajuint ajTableuintHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with an unsigned integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Constructors for hash tables
Functions: ajTableulongNew ajTableulongNewConst
Creates, initialises, and returns a new, empty table that can hold an
arbitrary number of unsigned long integer key-value pairs
Synopsis
Prototype
AjPTable ajTableulongNew (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold an
arbitrary number of unsigned long integer key-value pairs
See Also
See other functions in this section
Availability
In release 6.4.0
Creates, initialises, and returns a new, empty table that can hold an
arbitrary number of unsigned long integer key-value pairs
Synopsis
Prototype
AjPTable ajTableulongNewConst (
ajuint size
);
Type | Name | Read/Write | Description |
ajuint | size | Input | estimate of number of unique keys |
AjPTable | | RETURN | new table. |
Input
size: | (Input) | estimate of number of unique keys |
Returns
Description
Creates, initialises, and returns a new, empty table that can hold an
arbitrary number of unsigned long integer key-value pairs
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableulongFree ajTableulongFreeKey
Free keys and value strings in a table and free the table.
Use only where the keys and data
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableulongFree (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys and data
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
Synopsis
Prototype
void ajTableulongFreeKey (
AjPTable* Ptable
);
Type | Name | Read/Write | Description |
AjPTable* | Ptable | Delete | Table |
void | | RETURN | |
Output
Returns
Description
Free keys and value strings in a table and free the table.
Use only where the keys
in the table are real, and not just copies of pointers. Otherwise
a call to ajTableFree is enough.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableulongFetch
returns the value associated with key in table, or null
if table does not hold key.
Synopsis
Prototype
const ajulong* ajTableulongFetch (
const AjPTable table,
const ajulong* ulongkey
);
Type | Name | Read/Write | Description |
const AjPTable | table | Input | table to search |
const ajulong* | ulongkey | Input | key to find. |
const ajulong* | | RETURN | value associated with key |
Input
table: | (Input) | table to search |
ulongkey: | (Input) | key to find. |
Returns
const ajulong*: | value associated with key |
Description
returns the value associated with key in table, or null
if table does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableulongFetchmod
Returns the value associated with key in table, or null if table
does not hold key.
Synopsis
Prototype
ajulong* ajTableulongFetchmod (
AjPTable table,
const ajulong* ulongkey
);
Type | Name | Read/Write | Description |
AjPTable | table | Modify | table to search |
const ajulong* | ulongkey | Input | key to find. |
ajulong* | | RETURN | value associated with key |
Input
ulongkey: | (Input) | key to find. |
Input & Output
table: | (Modify) | table to search |
Returns
ajulong*: | value associated with key |
Description
Returns the value associated with key in table, or null if table
does not hold key.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajTableulongCmp ajTableulongHash
Comparison function for a table with an unsigned long integer key
Synopsis
Prototype
ajint ajTableulongCmp (
const void* x,
const void* y
);
Type | Name | Read/Write | Description |
const void* | x | Input | Standard argument. Item value. |
const void* | y | Input | Standard argument. Comparison item value. |
ajint | | RETURN | Comparison result. Zero if equal, non-zero if different. |
Input
x: | (Input) | Standard argument. Item value. |
y: | (Input) | Standard argument. Comparison item value. |
Returns
ajint: | Comparison result. Zero if equal, non-zero if different. |
Description
Comparison function for a table with an unsigned long integer key
See Also
See other functions in this section
Availability
In release 6.4.0
Hash function for a table with an unsigned long integer key
Synopsis
Prototype
ajuint ajTableulongHash (
const void* key,
ajuint hashsize
);
Type | Name | Read/Write | Description |
const void* | key | Input | Standard argument. Table key. |
ajuint | hashsize | Input | Standard argument. Estimated Hash size. |
ajuint | | RETURN | Hash value in range 0 to hashsize-1 |
Input
key: | (Input) | Standard argument. Table key. |
hashsize: | (Input) | Standard argument. Estimated Hash size. |
Returns
ajuint: | Hash value in range 0 to hashsize-1 |
Description
Hash function for a table with an unsigned long integer key
See Also
See other functions in this section
Availability
In release 6.4.0