TDiskDictionary class

Member functions for TDiskDictionary and TDiskDictionaryIterator are shown in Figure 26. You instantiate TDiskDictionary to read and write instances of key-value pairs on disk. A TDiskDictionary works like a TDictionaryOf in the collection classes: you supply MCollectible derived keys and values, which are written to disk. Instances that you place in disk dictionaries must override the IsEqual and Hash member functions for comparisons to work correctly. When creating an instance of TDictionaryOf, you need to provide a directory and a name for the dictionary in the constructor.

Operations you can perform on dictionaries include: adding, retrieving and removing items; checking for membership of an item; counting the occurrences of a specific item; and closing or deleting disk files holding dictionary data.

Use TDiskDictionaryIterator to step through the key-value pairs stored in a disk dictionary. This iterator is different from most other collection-based iterators in the system because you own the object returned by the iterator on each call to First, Next, FirstKey, and NextKey. Consequently, you are responsible for deleting objects returned by the iterator. You instantiate the iterator by providing an open TDiskDictionary instance in the iterator's constructor.



[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker