Class: TMonomorphicValueAccessorFor

Declaration: HeteroDiskDictionary.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TValueAccessor

Inherited By:

None.

Purpose:

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 AValue::operator >>=and <<=. 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 TMonomorphicValueAccessorFor as a parameter, prior to adding or copying using a TMonomorphicValueAccessorFor.

Member Function: TMonomorphicValueAccessorFor::TMonomorphicValueAccessorFor

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

Interface Category:

API.

Purpose:

  1. Default constructor. Creates a TMonomorphicValueAccessorFor.
  2. Copy constructor. Creates a TMonomorphicValueAccessorFor given a TMonomorphicValueAccessorFor.
  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 TMonomorphicValueAccessorFor.
  3. Called to copy a TMonomorphicValueAccessorFor.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMonomorphicValueAccessorFor::operator=

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

Interface Category:

API.

Purpose:

  1. Returns a dereferenced copy of the TMonomorphicValueAccessorFor.
  2. Returns a dereferenced copy of the TMonomorphicValueAccessorFor, using a TValueAccessor. No type checking is performed so, caveat emptor.

Calling Context:

  1. Called to return a dereferenced copy of the TMonomorphicValueAccessorFor.
  2. Called to return a dereferenced copy of the TMonomorphicValueAccessorFor.

Parameters:

Return Value:

Returns a dereferenced copy of the TMonomorphicValueAccessorFor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMonomorphicValueAccessorFor::~TMonomorphicValueAccessorFor

~ TMonomorphicValueAccessorFor ()

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: TMonomorphicValueAccessorFor::Add

bool Add (const AValue & theValue, 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. Throws TDiskDictionaryInvalidArgumentsException if SetKey has not been called.

Concurrency:

Not multithread safe.

Other Considerations:

Add objects by calling AValue::operator >>=. If you call this member function and have _not called SetKey, a TInvalidUseOfNILPointer exception is thrown.

Member Function: TMonomorphicValueAccessorFor::Copy

AValue * Copy () const

Interface Category:

API.

Purpose:

Retrieves a value object from the disk dictionary according to the previously specified key. The returned object is allocated on the same heap as this accessor.

Calling Context:

Called to copy 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. Throws TDiskDictionaryInvalidArgumentsException if SetKey has not been called.

Concurrency:

Not multithread safe.

Other Considerations:

Use this member function when the associated Add member function was used to store the value. If any other member function was used to add the value, a TInvalidStreamData exception is thrown. The returned object is allocated on the same heap as this accessor. If the value does not exist, this function returns NIL. This member function must be used in conjunction with MAccessorHelperFor<AKey>::SetKey(...).

Member Function: TMonomorphicValueAccessorFor::Retrieve

bool Retrieve (AValue & fillinValue) const

Interface Category:

API.

Purpose:

Retrieves a value from the disk dictionary into a preallocated value object.

Calling Context:

Called to retrieve a value from the disk dictionary into a pre-allocated value object.

Parameters:

Return Value:

Returns true if the value does exist and will call fillinValue <<=.

Exceptions:

Throws a derived class of TPersistentStorageException if an internal failure occurred. Throws TDiskDictionaryInvalidArgumentsException if SetKey has not been called.

Concurrency:

Not multithread safe.

Other Considerations:

Use this member function when the associated Add member function was used to store the value. If any other member function was used to add the value, a TInvalidStreamData exception is thrown. The returned object is allocated on the same heap as this accessor. 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.