Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TAbstractComparator
Inherited By:
TMCollectibleComparator
TNamesMatchComparator
TNullHashOperatorComparator
TOperatorComparator
TOrderedComparator
Purpose:
TComparator is an abstract class that you can use to perform comparison and hash operations on comparator objects.
Instantiation:
Allocate on the heap. These are adopted by the collections.
Deriving Classes:
Derive classes from TComparator when writing your own comparators.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Other Considerations:
None.
Member Function: TComparator::Compare
virtual EComparisonResult Compare (const AType & leftObj, const AType & rightObj) const
Interface Category:
API.
Purpose:
Compares two objects of the same type.
Calling Context:
Call this function directly to compare two objects.
Normally called internally. Could be called externally to compare objects of AType.
Parameters:
- const AType & leftObj -The left-hand object.
- const AType & rightObj -The right-hand object.
Return Value:
Returns kLessThan, kGreaterThan, kEqual, kNotEqual, or kUndefined.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TComparator::GetHash
virtual HashResult GetHash (const AType & obj) const
Interface Category:
API.
Purpose:
Generates a hash value for an object.
Calling Context:
Call this function directly to generate a hash value for an object.
Normally called internally. Could be called externally to get the hash of an AType object.
Parameters:
- const AType & obj -The object for which the hash value is to be generated.
Return Value:
The hash value generated.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TComparator::TypeSafeCompare
virtual EComparisonResult TypeSafeCompare (void * leftObj, void * rightObj) const
Interface Category:
API.
Purpose:
Compares two objects of different types.
Calling Context:
Call this function directly to compare two objects of different types.
Call this function internally.
Parameters:
- void * leftObj -The left-hand object.
- void * rightObj -The right-hand object.
Return Value:
Returns kLessThan, kGreaterThan, kEqual, kNotEqual, or kUndefined.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TComparator::TypeSafeGetHash
virtual HashResult TypeSafeGetHash (void * obj) const
Interface Category:
API.
Purpose:
Given a reference to an object, correctly casts and generates a hash value for the object.
Calling Context:
Call this function directly to generate a hash value for an object.
Call this function internally.
Parameters:
- void * obj -The object for which a hash value is to be generated.
Return Value:
The hash value.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TComparator ()
- TComparator (const TComparator < AType > &)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
Calling Context:
- Call this function directly anywhere the creation of a TComparator is desired.
- Call this function directly to copy an object.
Parameters:
- Takes no parameters.
- const TComparator < AType > & -The object to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TComparator::operator=
const TComparator < AType > & operator =(const TComparator < AType > &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function directly when an object is assigned to another compatible object.
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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.