home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
WmtRWTPtrSet.hxx
< prev
next >
Wrap
Text File
|
1996-05-31
|
2KB
|
57 lines
/*---------------------------------------------------------------------------
*
* (c) Westmount Technology 1994
*
* File: @(#)WmtRWTPtrSet.hxx 1.2
* Author: peku
* Description: pointer set based on RogueWave library
*---------------------------------------------------------------------------
SccsId = @(#)WmtRWTPtrSet.hxx 1.2 03 Jun 1994 Copyright 1994 Westmount Technology */
#ifndef WMTRWTPTRSET_HXX
#define WMTRWTPTRSET_HXX
#ifndef __RWTVHSET_H__
#include "rw/tvhset.h"
#endif
typedef void* voidptr;
unsigned WmtRWTHashVoidPtr(const voidptr& p);
template<class T>
#ifdef __GNUG__
class WmtRWTPtrSet : public RWTValHashSet<voidptr> {
#else
class WmtRWTPtrSet : private RWTValHashSet<voidptr> {
#endif
public:
WmtRWTPtrSet() : RWTValHashSet<voidptr>(WmtRWTHashVoidPtr) {}
void doInsert(T *ptr)
{ RWTValHashSet<voidptr>::insert(ptr); }
RWBoolean doRemove(T *ptr)
{ return RWTValHashSet<voidptr>::remove(ptr); }
void doClear()
{ RWTValHashSet<voidptr>::clear(); }
RWBoolean doIsEmpty() const
{ return RWTValHashSet<voidptr>::isEmpty(); }
};
template <class T>
class WmtRWTPtrSetIterator : private RWTValHashTableIterator<voidptr> {
public:
// cast away const
// strange: RWTValHashTableIterator does not have
// const parameter in the constructor
//
WmtRWTPtrSetIterator(const WmtRWTPtrSet<T>& c) :
RWTValHashTableIterator<voidptr>((RWTValHashSet<voidptr>&)c) {}
T *key() const { return (T*)RWTValHashTableIterator<voidptr>::key(); }
RWBoolean operator++()
{ return RWTValHashTableIterator<voidptr>::operator++(); }
void reset() { RWTValHashTableIterator<voidptr>::reset(); }
};
#endif /* WMTRWTPTRSET_HXX */