Class: TForeignDataType

Declaration: ForeignData.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TForeignFileExtension TMIMEForeignDataType

Purpose:

TForeignDataType is an abstract base class that provides a protocol for comparing the types of foreign data. It is used throughout the translation framework to represent the data type on the foreign end of a translation. Translator surrogates use it to store collections of the foreign data types that they accept.

Instantiation:

Allocate on the heap or the stack. Safe to allocate at static constructor time. Safe to allocate in an alternate heap and in shared memory.

Deriving Classes:

TForeignDataType is an abstract class that provides only the protocol for comparing foreign data type. Deriving classes must store the appropriate representation of the data type. For example, a class representing Macintosh clipboard types would store an OSType such as TEXT or PICT. Deriving classes must also override the pure virtual operator== of this class. The derived class implementation of operator== must check for class equivalence before comparing the contents of the objects. TForeignDataType uses the DynamicCast macros to facilitate this checking, and all derived classes must use the macros as well.

Concurrency:

Not multithread safe. The exceptions are the two const member functions operator==, Hash, and operator>>=, which are multithread safe and which must be multithread safe in all derived class' implementations.

Resource Use:

No special requirements.

Member Function: TForeignDataType::~TForeignDataType

virtual ~ TForeignDataType ()

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: TForeignDataType::operator>>=

TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

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:

Multithread safe.

Other Considerations:

None.

Member Function: TForeignDataType::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:

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

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignDataType::TForeignDataType

  1. TForeignDataType ()
  2. TForeignDataType (const TForeignDataType &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and by 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: TForeignDataType::operator=

TForeignDataType & operator =(const TForeignDataType & other)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Must be called from derived class' assignment operators.

Parameters:

Return Value:

A reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TForeignDataType::operator!=

virtual bool operator != (const TForeignDataType & other) const

Interface Category:

API.

Purpose:

Inequality operator. This is a pure virtual function: developers must provide a definition for their derived classes of this member function.

Calling Context:

Called to compare two foreign data type objects for inequality.

Parameters:

Return Value:

True the objects do not represent the same foreign data type, false if they do. See operator==.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. The exceptions are.

Other Considerations:

None.

Member Function: TForeignDataType::operator==

virtual bool operator ==(const TForeignDataType & other) const

Interface Category:

API.

Purpose:

Compare two foreign data type instances for equality. This is a pure virtual function: developers must provide a definition for their derived classes of this member function.

Calling Context:

Called by developer code to compare two foreign data types for equality, and called internally by the framework as part of type negotiation.

Parameters:

Return Value:

True if the two objects represent the same foreign data type, false if not.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. The exceptions are.

Other Considerations:

None.

Member Function: TForeignDataType::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Compute a hash value for the foreign data type instance. This is a pure virtual function: developers must provide a definition for their derived classes of this member function.

Calling Context:

Called internally by the framework as part of holding on to, and doing type negotiations on, foreign data type instances.

Parameters:

Return Value:

Derived classes should return a value which relatively uniquely represents their data type. All objects which compare equal using operator== should return the same hash value; however, not all objects returning the same hash value will return true from operator==.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. The exceptions are.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.