home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------
- *
- * (c) Westmount Technology 1994
- *
- * File: @(#)CList.hxx 1.1
- * Author: peku
- * Description: Compact Lists
- *---------------------------------------------------------------------------
- SccsId = @(#)CList.hxx 1.1 18 Oct 1994 Copyright 1994 Westmount Technology */
-
- #ifndef CLIST_HXX
- #define CLIST_HXX
-
- #ifndef FLEXARRAY_HXX
- #include "FlexArray.hxx"
- #endif
-
- class GenCList: public GenFlexArray {
- public:
- GenCList(unsigned size = DEFAULT_ARRAY_SIZE, int grow_factor = +1);
- GenCList(const GenCList&);
- GenCList& operator=(const GenCList&);
-
- void** as_void_array()
- { if ( idx < sz || grow (sz+1) ) v[idx] = 0; return v; }
-
- void reset();
- void reset(unsigned new_size);
-
- GenCList& append(void*);
- GenCList& append(const GenCList&);
- GenCList& insert_at(int i, void*);
- GenCList& insert_at(int i, const GenCList&);
-
- GenCList& remove_last();
- GenCList& remove_at(int i);
- GenCList& remove(int i, int j);
- GenCList& remove(void*);
-
- unsigned size() const { return idx; }
-
- void*& operator[](int i) const { return v[i]; }
-
- void operator&= (void* elem) { append(elem); }
- void operator&= (const GenCList& lst) { append(lst); }
-
- protected:
- int idx;
-
- private:
- int grow_factor;
- int grow(unsigned min_size);
- };
-
- #endif /* CLIST_HXX */
-