Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TValueAccessor
Inherited By:
None.
Purpose:
A value accessor that is aware of the key type.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
This class is used in conjunction with a MAccessorHelperFor<AKey> (for example, THeterogenousDiskDictionaryOf<AKey>) to add and retrieve values.
Other Considerations:
None.
- TKeyValueAccessorFor (const MAccessorHelperFor < AKey > & helper)
- TKeyValueAccessorFor (const TKeyValueAccessorFor < AKey, AValue >& copy)
Interface Category:
API.
Purpose:
- Constructor. Creates a TKeyValueAccessorFor given a MAccessorHelperFor<AKey> (for example, THeterogenousDiskDictionaryOf<AKey>).
- Copy constructor. Creates a TKeyValueAccessorFor given a TKeyValueAccessorFor.
Calling Context:
- Called at construction to create an accessor for adding and retrieving values from a THeterogenousDiskDictionaryOf.
- Called to copy a TKeyValueAccessorFor.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TKeyValueAccessorFor < AKey , AValue >& operator =(const TKeyValueAccessorFor < AKey, AValue >& right)
Interface Category:
API.
Purpose:
Returns a dereferenced copy of the TKeyValueAccessorFor.
Calling Context:
Called to return a dereferenced copy of the TKeyValueAccessorFor.
Parameters:
- const TKeyValueAccessorFor < AKey -Specifies the class of the key object that the accessor will use.
- AValue >& right -Specifies the class of the value object that the accessor will use.
Return Value:
Returns a dereferenced copy of the TKeyValueAccessorFor.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
~ TKeyValueAccessorFor ()
Interface Category:
API.
Purpose:
Destructor. Releases the resources associated with the TKeyValueAccessorFor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool Add (const AKey & theKey, const AValue & theValue, const TStreamer < AValue > & streamer, bool replaceExistingValue =false) const
Interface Category:
API.
Purpose:
Adds a key-value pair to the disk dictionary. Use this member function to add objects using a streamer.
Calling Context:
Called to add a key-value pair to the disk dictionary.
Parameters:
- const AKey & theKey -Specifies the key object to be added.
- const AValue & theValue -Specifies the value object to be added.
- const TStreamer < AValue > & streamer -Specifies an object that can perform streaming operations with the value object.
- bool replaceExistingValue =false -If the replace flag is false and there is a key that is equal to the passed-in key, then returns false. If the replace flag is true and there is a key that is equal to the passed-in key, then replaces the value with the passed-in value. If there is no existing record, then adds the record regardless of the replace flag. The default is set to false.
Return Value:
Returns true if an add/replace operation is actually performed.
Exceptions:
Throws TDiskDictionaryPermissionsException::kReadOnly if the TDiskDictionaryOf was instantiated ReadOnly.
Throws a derived class of TPersistentStorageException if an internal failure occurred.
Concurrency:
Not multithread safe.
Other Considerations:
None.
AValue * Copy (const AKey & theKey, const TStreamer < AValue > & streamer) const
Interface Category:
API.
Purpose:
Retrieves a value object from the disk dictionary according to the specified key. Note that the same type of streamer must be used here as was used on the Add. The returned object is allocated on the same heap as this accessor.
Calling Context:
Called to retrieve a value object from the disk dictionary.
Parameters:
- const AKey & theKey -Specifies the key of the record to be retrieved.
- const TStreamer < AValue > & streamer -Specifies an object that can perform streaming operations with the value object.
Return Value:
Returns the value object associated with this key, or NIL if no value is found.
Exceptions:
Throws a derived class of TPersistentStorageException if an internal failure occurred.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.