Class: TKeyValueAccessorFor

Declaration: HeteroDiskDictionary.h

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.

Member Function: TKeyValueAccessorFor::TKeyValueAccessorFor

  1. TKeyValueAccessorFor (const MAccessorHelperFor < AKey > & helper)
  2. TKeyValueAccessorFor (const TKeyValueAccessorFor < AKey, AValue >& copy)

Interface Category:

API.

Purpose:

  1. Constructor. Creates a TKeyValueAccessorFor given a MAccessorHelperFor<AKey> (for example, THeterogenousDiskDictionaryOf<AKey>).
  2. Copy constructor. Creates a TKeyValueAccessorFor given a TKeyValueAccessorFor.

Calling Context:

  1. Called at construction to create an accessor for adding and retrieving values from a THeterogenousDiskDictionaryOf.
  2. Called to copy a TKeyValueAccessorFor.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TKeyValueAccessorFor::operator=

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:

Return Value:

Returns a dereferenced copy of the TKeyValueAccessorFor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TKeyValueAccessorFor::~TKeyValueAccessorFor

~ 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.

Member Function: TKeyValueAccessorFor::Add

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:

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.

Member Function: TKeyValueAccessorFor::Copy

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:

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.