home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWCOLCLASS_H__
- #define __RWCOLCLASS_H__
- pragma push_align_members(64);
-
- /*
- * Base class for the Smalltalk(TM)-like collection classes.
- *
- * $Header: E:/vcs/rw/colclass.h_v 1.3 18 Feb 1992 09:54:12 KEFFER $
- *
- ****************************************************************************
- *
- * Rogue Wave
- * P.O. Box 2328
- * Corvallis, OR 97339
- * Voice: (503) 754-3010 FAX: (503) 757-6650
- *
- * Copyright (C) 1989, 1990, 1991. This software is subject to copyright
- * protection under the laws of the United States and other countries.
- *
- ***************************************************************************
- *
- * $Log: E:/vcs/rw/colclass.h_v $
- *
- * Rev 1.3 18 Feb 1992 09:54:12 KEFFER
- *
- * Rev 1.2 28 Oct 1991 09:08:08 keffer
- * Changed inclusions to <rw/xxx.h>
- *
- * Rev 1.1 29 Jul 1991 13:53:02 keffer
- * Changed return type of asBag(), asOrderedCollection(), asSet() and
- * asSortedCollection() to their RW names.
- *
- * Rev 1.0 28 Jul 1991 08:13:12 keffer
- * Tools.h++ V4.0.5 PVCS baseline version
- *
- */
-
- #include "rw/collect.h"
-
- class RWExport RWCollection : public RWCollectable {
- public:
- static const unsigned DEFAULT_CAPACITY;
- static const unsigned DEFAULT_RESIZE;
- public:
-
- /************* Virtual function inherited from RWCollectable *****************/
- virtual unsigned binaryStoreSize() const;
- virtual ClassID isA() const {return __RWCOLLECTION;}
- virtual void restoreGuts(RWvistream&);
- virtual void restoreGuts(RWFile&);
- virtual void saveGuts(RWvostream&) const;
- virtual void saveGuts(RWFile&) const;
-
- /**************** Added virtual functions for RWCollections ****************/
- virtual void apply(RWapplyCollectable, void*) = 0;
- virtual void clear() = 0;
- virtual void clearAndDestroy();
- virtual RWBoolean contains(const RWCollectable*) const;
- virtual unsigned entries() const = 0; // Total entries
- virtual RWCollectable* find(const RWCollectable*) const = 0; // First occurrence
- virtual RWCollectable* insert(RWCollectable*) = 0;
- virtual RWBoolean isEmpty() const = 0;
- virtual unsigned occurrencesOf(const RWCollectable*) const = 0;
- virtual RWCollectable* remove(const RWCollectable*) = 0; // Remove first occurrence
- virtual void removeAndDestroy(const RWCollectable*);
-
- /************************ Special functions *******************************/
- void operator+=(const RWCollection& c); // Add items of c to self
- void operator-=(const RWCollection& c); // Remove items of c from self
- void addContentsTo(RWCollection*) const;
- RWBag asBag() const;
- RWOrdered asOrderedCollection() const;
- RWSet asSet() const;
- RWBinaryTree asSortedCollection() const;
- RWCollection* select(RWtestCollectable, void*) const;
- };
-
- typedef void (*RWapplyKeyAndValue)(RWCollectable*, RWCollectable*, void*);
-
- pragma pop_align_members();
- #endif /* __RWCOLCLASS_H__ */
-