home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ISSKSS.H
< prev
next >
Wrap
Text File
|
1993-09-22
|
8KB
|
197 lines
/*******************************************************************************
* *
* COPYRIGHT: *
* IBM C/C++ Tools Version 2.01 - Collection Class Library *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _ISSKSS_H
#define _ISSKSS_H
#include <iglobals.h>
#include <icursor.h>
template < class Element, class ElementOps, class Base >
class IWSrtSetOnKSSet {
Base ivBase;
class Cursor;
friend class Cursor;
public:
class Cursor : public Base::Cursor {
protected:
IBoolean isFor (IWSrtSetOnKSSet < Element, ElementOps, Base > const& c) const
{ return Base::Cursor::isFor (c.ivBase); }
public:
Cursor (IWSrtSetOnKSSet < Element, ElementOps, Base > const& c)
: Base::Cursor (c.ivBase) {}
};
IWSrtSetOnKSSet (INumber
numberOfElements = 100);
IWSrtSetOnKSSet (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
IWSrtSetOnKSSet < Element, ElementOps, Base >&
operator = (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
~IWSrtSetOnKSSet ();
IBoolean add (Element const&);
IBoolean add (Element const&,
ICursor&);
void addAllFrom (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
Element const& elementAt (ICursor const&) const;
Element& elementAt (ICursor const&);
Element const& anyElement () const;
void removeAt (ICursor const&);
INumber removeAll (IBoolean (*property)
(Element const&, void*),
void* additionalArgument = 0);
void replaceAt (ICursor const&,
Element const&);
void removeAll ();
IBoolean isBounded () const;
INumber maxNumberOfElements () const;
INumber numberOfElements () const;
IBoolean isEmpty () const;
IBoolean isFull () const;
ICursor* newCursor () const;
IBoolean setToFirst (ICursor&) const;
IBoolean setToNext (ICursor&) const;
IBoolean allElementsDo (IBoolean (*function)
(Element&, void*),
void* additionalArgument = 0);
IBoolean allElementsDo (IIterator <Element>&);
IBoolean allElementsDo (IBoolean (*function)
(Element const&, void*),
void* additionalArgument = 0)
const;
IBoolean allElementsDo (IConstantIterator
<Element>&) const;
IBoolean isConsistent () const;
IBoolean contains (Element const&) const;
IBoolean containsAllFrom (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
IBoolean locate (Element const&, ICursor&)
const;
IBoolean locateOrAdd (Element const&);
IBoolean locateOrAdd (Element const&,
ICursor&);
IBoolean remove (Element const&);
IBoolean operator == (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
IBoolean operator != (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
void unionWith (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void intersectionWith (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void differenceWith (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void addUnion (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void addIntersection (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void addDifference (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
void removeFirst ();
void removeLast ();
void removeAtPosition (IPosition);
Element const& firstElement () const;
Element const& lastElement () const;
Element const& elementAtPosition (IPosition) const;
IBoolean setToLast (ICursor&) const;
IBoolean setToPrevious (ICursor&) const;
void setToPosition (IPosition,
ICursor&) const;
IBoolean isFirst (ICursor const&) const;
IBoolean isLast (ICursor const&) const;
long compare (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
long (*comparisonFunction)
(Element const&,
Element const&)) const;
protected:
static IBoolean isContained (Element const&, void* env);
static IBoolean isNotContained (Element const&, void* env);
};
#define IDefineGSortedSetOnGKeySortedSet(GKSSet, GSSet) \
template < class Element, class ElementOps > \
class GKSSet ## ForGSSet : \
public GKSSet < Element, Element, \
IOpsWithKey < Element, ElementOps > > { \
public: \
GKSSet ## ForGSSet (INumber n = 100) : \
GKSSet < Element, Element, \
IOpsWithKey < Element, ElementOps > > (n) {} \
}; \
template < class Element, class ElementOps > \
class GSSet : \
public IWSrtSetOnKSSet < Element, ElementOps, \
GKSSet ## ForGSSet < Element, ElementOps > > { \
public: \
GSSet (INumber n = 100) : \
IWSrtSetOnKSSet < Element, ElementOps, \
GKSSet ## ForGSSet < Element, ElementOps > > (n) {} \
};
#include <isskss.if>
#ifdef __IBMCPP__
#ifndef __TEMPINC__
#include <isskss.c>
#endif
#endif
#endif