Gets the number of key-value pairs in an SRP Hash Table.

Syntax

Count = SRP_HashTable_Count(Handle)

Returns

The number of elements in the hash table

Parameters

ParameterDescription
HandleHandle to an existing SRP Hash Table (REQUIRED)

Remarks

The SRP_HashTable_Count method gets the number of key-value pairs in an SRP Hash Table. The count includes blank elements. In other words, this method tells you the number of elements you will get when you call SRP_HashTable_GetKeys or SRP_HashTable_GetValues.

IMPORTANT: You should always release the handle to an SRP Hash Table when you no longer need it by calling SRP_HashTable_Release.

Examples

// Create a case-insensitive hash table
Handle = SRP_HashTable_Create()

// Add some entries
SRP_HashTable_Set(Handle, "Amazon", "http://www.amazon.com")
SRP_HashTable_Set(Handle, "Google", "http://www.google.com")
SRP_HashTable_Set(Handle, "Revelation", "http://www.revelation.com")
SRP_HashTable_Set(Handle, "SRP", "http://www.srpcs.com")
SRP_HashTable_Set(Handle, "Yahoo", "http://www.yahoo.com")

// This will return 5
Count = SRP_HashTable_Count(Handle)
  • No labels