2.2. Maintaining a Point Hash Table

The Cogent third-party library provides a mechanism for internally managing DataHub point information within your own program. This mechanism uses a hash table based on the name of the point. The hashing function uses binary search in order to resolve collisions within the hash table. The maximum length of the ordered array is 32000 points, and the length of the hash table is 256 entries. This places a limit of 32000 points per hash entry and 8192000 total points in the table. At the time of this writing, the hashing function uses a first-character lookup on the point name, meaning that the hash table preserves alphabetical order, but imposes a limit of 32000 points starting with the same letter on the datahub.

In order to maintain a point hash table within your program, you must use the function Pt_InitClient, which will set up a static hash table within your program. In order to look up a point within the hash table, you use the function PT_FindCPoint, which will create an entry in the hash table if necessary and return the resulting point structure.