class indexed

An indexed collection stores references to objects.

Inheritance:


Public Methods

[more] indexed()
[more] indexed(unsigned int capacity, unsigned int grow = DEFAULT_CONTAINER_GROWTH)
Capacity is the initial memory set aside to hold elements.
[more] indexed(const indexed &src)
Pointers to the objects in the original index are copied into the new index, the objects themselves are not copied
[more]inline unsigned int getSize() const
The last index is at size - 1
[more]inline unsigned int getCapacity() const
Reports the current capacity of the data structure
[more]void trim()
Reduces the capacity to fit its current size.
[more]void enlarge(unsigned adjustment)
Increases the capacity by adjustment value
[more]inline object* operator[](unsigned index) const
Returns a pointer to the object stored at index
[more]inline object* getObj(unsigned index) const
Returns a pointer to the object stored at index
[more]virtual void swap(unsigned int i, unsigned int j)
Swaps the pointers at index i and j
[more]virtual void append(const indexed& src)
Appends the items in src to this indexed
[more]virtual void empty()
Deletes all objects contained in the indexed.
[more]virtual void removeAll()
Removes all objects from container
[more]virtual void add(object* obj)
Adds an object to the end of the indexed (last index)
[more]virtual object* remove(unsigned int index)
Removes and returns the object at the indicated index
[more]virtual ~indexed()
Deletes the structure.


Inherited from object:

Public Methods

ovirtual bool operator==(const object &obj) const
ovirtual bool operator!=(const object &obj) const
ovirtual unsigned int hashcode() const
ovirtual object* clone() const


Documentation

An indexed collection stores references to objects. It supports indexed access to objects (via the [] operator), addition of new objects (with automatics memory management), and removal of objects from the collection.

New elements are appended to the end of the indexed collection. When an element is removed, the last element of the collection fills the vacant slot, thereby avoiding holes in the indexing.

Virtual functions do not make calls to other virtual functions

o indexed()

o indexed(unsigned int capacity, unsigned int grow = DEFAULT_CONTAINER_GROWTH)
Capacity is the initial memory set aside to hold elements. When the collection becomes full, its size is increased by grow slots.

o indexed(const indexed &src)
Pointers to the objects in the original index are copied into the new index, the objects themselves are not copied

oinline unsigned int getSize() const
The last index is at size - 1

oinline unsigned int getCapacity() const
Reports the current capacity of the data structure

ovoid trim()
Reduces the capacity to fit its current size. Undefined if size == 0.

ovoid enlarge(unsigned adjustment)
Increases the capacity by adjustment value

oinline object* operator[](unsigned index) const
Returns a pointer to the object stored at index

oinline object* getObj(unsigned index) const
Returns a pointer to the object stored at index

ovirtual void swap(unsigned int i, unsigned int j)
Swaps the pointers at index i and j

ovirtual void append(const indexed& src)
Appends the items in src to this indexed

ovirtual void empty()
Deletes all objects contained in the indexed. Sets size to zero.

ovirtual void removeAll()
Removes all objects from container

ovirtual void add(object* obj)
Adds an object to the end of the indexed (last index)

ovirtual object* remove(unsigned int index)
Removes and returns the object at the indicated index

ovirtual ~indexed()
Deletes the structure. Has no effect on elements.


Direct child classes:
collection

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.