Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LComparator Class Reference
["Arrays" Arrays and Iterators]

#include <LComparator.h>

Inheritance diagram for LComparator:

Inheritance graph
[legend]
Collaboration diagram for LComparator:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base to provide comparison for equality and sorting typically for LArray.

Subclasses must implement Compare().

Uses interesting twist on Singleton pattern. There is a static Factory function GetComparator which will supply a static Comparator, creating one if necessary. This is typically reimplemented with a different static variable in subclasses so each has their own Get factory function and Singleton variable.

This comprises an application-level leak in PowerPlant.

Todo:
fix the Comparator static leaks.


Public Methods

 LComparator ()
virtual ~LComparator ()
 Cleanup the Singleton pointer if it is us.

virtual SInt32 Compare (const void *inItemOne, const void *inItemTwo, UInt32 inSizeOne, UInt32 inSizeTwo) const
virtual Boolean IsEqualTo (const void *inItemOne, const void *inItemTwo, UInt32 inSizeOne, UInt32 inSizeTwo) const
virtual SInt32 CompareToKey (const void *inItem, UInt32 inSize, const void *inKey) const
virtual Boolean IsEqualToKey (const void *inItem, UInt32 inSize, const void *inKey) const
virtual LComparator * Clone ()

Static Public Methods

LComparator * GetComparator ()

Static Protected Attributes

LComparator * sComparator
 Singleton pointer to a comparator obtained with GetComparator.


Constructor & Destructor Documentation

LComparator::LComparator  
 

LComparator::~LComparator   [virtual]
 

Cleanup the Singleton pointer if it is us.


Member Function Documentation

LComparator * LComparator::Clone   [virtual]
 

Reimplemented in LLongComparator.

SInt32 LComparator::Compare const void *    inItemOne,
const void *    inItemTwo,
UInt32    inSizeOne,
UInt32    inSizeTwo
const [virtual]
 

Reimplemented in LLongComparator.

SInt32 LComparator::CompareToKey const void *    inItem,
UInt32    inSize,
const void *    inKey
const [virtual]
 

LComparator * LComparator::GetComparator   [static]
 

Reimplemented in LLongComparator.

Boolean LComparator::IsEqualTo const void *    inItemOne,
const void *    inItemTwo,
UInt32    inSizeOne,
UInt32    inSizeTwo
const [virtual]
 

Reimplemented in LLongComparator.

Boolean LComparator::IsEqualToKey const void *    inItem,
UInt32    inSize,
const void *    inKey
const [virtual]
 


Member Data Documentation

LComparator * LComparator::sComparator [static, protected]
 

Singleton pointer to a comparator obtained with GetComparator.

Don't know why this is protected rather than private, consider that a dodgy bit of original PowerPlant design.


The documentation for this class was generated from the following files:
Generated on Mon Jul 22 18:20:51 2002 for PP2MFC by doxygen1.2.17