Class: TForeignData

Declaration: ForeignData.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TForeignFileData

Purpose:

TForeignData is an abstract class which provides an interface for accessing foreign data. Deriving classes implement this interface for particular kinds of foreign data. Conceptually, TForeignData objects are only references to the foreign data and do not contain the actual data. For example, TForeignFileData stores the location of a foreign file but does not store the file's data.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

TForeignData is an abstract class that provides only the protocol for accessing foreign data. Deriving classes must override the member functions GetDataType, CreateStreamForReading, CreateStreamForWriting, and CreateDefaultTranscoder. TForeignData uses the DynamicCast macros to so that clients with special needs can determine which derived class is being used and can call custom member functions. All classes derived from TForeignData must use the DynamicCast macros as well.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TForeignData::~TForeignData

virtual ~ TForeignData ()

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: TForeignData::GetDataType

virtual const TForeignDataType * GetDataType () const

Interface Category:

API.

Purpose:

This pure virtual member function provides a way for clients to retrieve the type of the data represented by this object.

Calling Context:

This function can be called directly.

Parameters:

Return Value:

An alias to a TForeignDataType object representing the type of this data. Clients can use TForeignDataType::operator== or the DynamicCast macros to determine whether the foreign data type is appropriate for their needs. The pointer returned by this function is only valid as long as this TForeignData objects exists, and the caller must not delete the TForeignDataType object it points to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::CreateStreamForReading

virtual TRandomAccessStream * CreateStreamForReading (TMemoryHeap * =0) const

Interface Category:

API.

Purpose:

Create a random-access stream which can be used to read from the foreign data source represented by this object.

Calling Context:

This function can be called directly.

Parameters:

Return Value:

A pointer to a newly-created TRandomAccessStream object which can be used to read from this foreign data source. The caller is responsible for deleting the stream.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::CreateStreamForWriting

virtual TRandomAccessStream * CreateStreamForWriting (unsigned long initialSize =0, TMemoryHeap * =0)

Interface Category:

API.

Purpose:

Create a random-access stream which can be used to write to the foreign data sink represented by this object.

Calling Context:

This function can be called directly.

Parameters:

Return Value:

A pointer to a newly-created TRandomAccessStream object which can be used to write to this foreign data location. The stream must be growable. The caller is responsible for deleting the stream.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::CreateDefaultTranscoder

virtual TTranscoder * CreateDefaultTranscoder (TMemoryHeap * =0) const

Interface Category:

API.

Purpose:

Create a transcoder which can be used to export and import text to and from this foreign data location. Translators which have no special knowledge of text transcoding should use this member function rather than explicitly creating an ASCII or UTF-8 transcoder.

Calling Context:

This function can be called directly.

Parameters:

Return Value:

A pointer to a newly-created TTranscoder which can be used for importing and exporting text. The caller is responsible for deleting the transcoder.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::operator>>=

TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator. This operator streams out a reference to the foreign data's location. It does not stream out the actual foreign data contents.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::operator<<=

TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws TInvalidVersionError if the data on the stream is an unrecognized version. Passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::TForeignData

  1. TForeignData ()
  2. TForeignData (const TForeignData &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and derived class' constructors.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignData::operator=

TForeignData & operator =(const TForeignData & other)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

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.