Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TValueAccessor
Inherited By:
None.
Purpose:
A TValueAccessorFor<AValue> is a value accessor that is not aware of the key type. Users of this class need to use the MAccessorHelperFor<AKey> protocol on THeterogenousDiskDictionaryOf<AKey> to access values. This requires explicit use of a derived class of TAbstractStreamer<AValue>.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Other Considerations:
The client must call the SetKey member function of THeterogenousDiskDictionaryOf using the TValueAccessorFor as a parameter, prior to adding or copying using a TValueAccessorFor.
- TValueAccessorFor ()
- TValueAccessorFor (const TValueAccessorFor < AValue > & copy)
- TValueAccessorFor (const TValueAccessor & copy)
Interface Category:
API.
Purpose:
- Default constructor. Creates a TValueAccessorFor.
- Copy constructor. Creates a TValueAccessorFor given a TValueAccessorFor.
- Copy constructor. Initializes an instance of this class given a TValueAccessor. No type checking is performed so, caveat emptor.
Calling Context:
- Called by the stream-in operators.
- Called to copy a TValueAccessorFor.
- Called to copy a TValueAccessorFor.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TValueAccessorFor < AValue > & operator =(const TValueAccessorFor < AValue > & right)
- TValueAccessorFor < AValue > & operator =(const TValueAccessor & right)
Interface Category:
API.
Purpose:
- Returns a dereferenced copy of the TValueAccessorFor.
- Returns a dereferenced copy of the TValueAccessorFor given a TValueAccessor. No type checking is done.
Calling Context:
- Called to return a dereferenced copy of the TValueAccessorFor.
- Called to return a dereferenced copy of the TValueAccessorFor given a TValueAccessor. No type checking is done.
Parameters:
Return Value:
Returns a dereferenced copy of the TValueAccessorFor.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
~ TValueAccessorFor ()
Interface Category:
API.
Purpose:
Destructor.
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 AValue & theValue, const TStreamer < AValue > & streamer, bool replaceExistingValue =false) const
Interface Category:
API.
Purpose:
Adds a value to the disk dictionary.
Calling Context:
Called to add a value to the disk dictionary.
Parameters:
- 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:
Note that the same type of streamer must be passed in to the Copy function.
This member function must be used in conjunction with MAccessorHelperFor<AKey>::SetKey(...).
AValue * Copy (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 TStreamer < AValue > & streamer -Specifies an object that can perform streaming operations with the value object.
Return Value:
Returns the value object associated with the 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:
If a streamer was not used to add the value, a TInvalidStreamData exception is thrown. 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 (or the default heap if the accessor is stack allocated). If the value does not exist, this function returns NIL.
This member function must be used in conjunction with MAccessorHelperFor<AKey>::SetKey(...).
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.