Class: TValueAccessorFor

Declaration: HeteroDiskDictionary.h

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.

Member Function: TValueAccessorFor::TValueAccessorFor

  1. TValueAccessorFor ()
  2. TValueAccessorFor (const TValueAccessorFor < AValue > & copy)
  3. TValueAccessorFor (const TValueAccessor & copy)

Interface Category:

API.

Purpose:

  1. Default constructor. Creates a TValueAccessorFor.
  2. Copy constructor. Creates a TValueAccessorFor given a TValueAccessorFor.
  3. Copy constructor. Initializes an instance of this class given a TValueAccessor. No type checking is performed so, caveat emptor.

Calling Context:

  1. Called by the stream-in operators.
  2. Called to copy a TValueAccessorFor.
  3. Called to copy a TValueAccessorFor.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TValueAccessorFor::operator=

  1. TValueAccessorFor < AValue > & operator =(const TValueAccessorFor < AValue > & right)
  2. TValueAccessorFor < AValue > & operator =(const TValueAccessor & right)

Interface Category:

API.

Purpose:

  1. Returns a dereferenced copy of the TValueAccessorFor.
  2. Returns a dereferenced copy of the TValueAccessorFor given a TValueAccessor. No type checking is done.

Calling Context:

  1. Called to return a dereferenced copy of the TValueAccessorFor.
  2. 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.

Member Function: TValueAccessorFor::~TValueAccessorFor

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

Member Function: TValueAccessorFor::Add

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:

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(...).

Member Function: TValueAccessorFor::Copy

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:

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.