Main Page Modules Class Hierarchy Compound List File List Compound Members

# cHead Class Reference

`#include <chead.h>`

Inheritance diagram for cHead::

List of all members.

## Public Methods
Constructors, destructor, assignment
| cHead (const char *name=NULL)
| cHead (const cHead &h)
virtual | ~cHead ()
cHead& | operator= (const cHead &)
Redefined cObject member functions.
virtual cObject* | dup () const
virtual void | forEach (ForeachFunc f)
Container methods.
cObject* | find (const char *objname) const
int | count () const

## Detailed Description

Head of a cObject list. cObject and its derived classes contain pointers that enable the objects to be a node in a double-linked list. cObject has member functions to link and unlink to and from double-linked lists (See documentation on cObject::setOwner()) The head of such lists is always a cHead object. The lists are a means that provide that each object in the system is part of an object tree and can be accessed through pointers starting from a given point. The existence of such hierarchy is necessary for a user interface where we want each object to be 'visible' to the user. It is also unavoidable when we want the simulation to be restartable (we need to destroy objects created by the running simulation to start a new one). Last, it enables that all objects can be reached through forEach() on which many algorithms rely (e.g. saveresults()).

NOTE: the dup() and operator=() functions are NOT implemented. dup() would require that every object in the list be duplicated. Since cHead is mostly an internal class and is NOT intended for use by the programmer as a container class, the dup() operation was considered unnecessary.

See also:
  cIterator

## Constructor & Destructor Documentation

cHead::cHead ( | const char * name = NULL )

| Constructor.

cHead::cHead ( | const cHead & h )`[inline]`

| Copy constructor.

cHead::~cHead ( | )`[inline, virtual]`

| Destructor. Inherited from cObject, it deletes all owned objects (i.e. those in the list) that were created on the heap.

## Member Function Documentation

int cHead::count ( | ) const

| Returns the number of objects in the list.

cObject * cHead::dup ( | ) const`[inline, virtual]`

| Dupping is not implemented for this class. This function gives an error (throws cException) when called. Reimplemented from cObject.

cObject * cHead::find ( | const char * objname ) const

| Searches the list for an object with the given name and returns its pointer. If no such object was found, NULL is returned.

void cHead::forEach ( | ForeachFunc f )`[virtual]`

| Calls the function passed for each object in the list. Reimplemented from cObject.

cHead & cHead::operator= ( | const cHead & )`[inline]`

| Assignment is not supported by this class: this method throws a cException when called.

The documentation for this class was generated from the following file:

- chead.h