Extending persistent storage

To add new indexing functionality, extend the persistent storage subsystem by creating new dictionary and index classes. These classes plug into the existing subsystem and are usable right away. However, you do not extend this subsystem by deriving from existing classes. You can't subclass TDiskDictionary.

The model of the subsystem in Figure 28 shows components provided by the default persistent storage environment. The example presented here adds a sorted disk dictionary class and a sequential index class to the subsystem, as shown in Figure 30. The right side of the figure shows a new disk dictionary class. TSortedDiskDictionary, which uses the new indexing class, TSequentialIndex. TSequentialIndex uses the existing record manager to write the values out to disk.

New functionality added by TSequentialIndex includes searching, sorting, and indexing based on keys of an imaginary class, TOrderableCollectibleLong.


The original TDiskDictionary uses an index manager to implement its indexing technology and an instance of TRecordManager for managing values. The new TSortedDiskDictionary class uses a sequential index manager and the same record manager (TRecordManager) for managing values.

A TSortedDiskDictionary is used for the storage of orderable instances on the disk. It works like a TDiskDictionary. You can have arbitrary ordered keys and arbitrary values. Keys must be MOrderableCollectibles. Key instances that are placed in disk dictionaries need to override the IsEqual, IsLessThan, IsGreaterThan, and the Hash member functions. Value instances must be MCollectibles and must override the Hash member functions inherited from MCollectible. Be aware that you must write the TSequentialIndex manager yourself. TSequentialIndex associates the key with a record handle.


[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