#include <carray.h>
Inheritance diagram for cArray::
Public Methods | |
Constructors, destructor, assignment. | |
cArray (const cArray &list) | |
cArray (const char *name=NULL, int siz=0, int dt=10) | |
virtual | ~cArray () |
cArray& | operator= (const cArray &list) |
Redefined cObject member functions | |
virtual cObject* | dup () const |
virtual void | info (char *buf) |
virtual void | forEach (ForeachFunc f) |
virtual int | netPack () |
virtual int | netUnpack () |
Container functions. | |
int | items () const |
void | clear () |
int | add (cObject *obj) |
int | addAt (int m, cObject *obj) |
int | set (cObject *obj) |
int | find (cObject *obj) const |
int | find (const char *objname) const |
cObject* | get (int m) |
cObject* | get (const char *objname) |
const cObject* | get (int m) const |
const cObject* | get (const char *objname) const |
cObject* | operator[] (int m) |
cObject* | operator[] (const char *objname) |
const cObject* | operator[] (int m) const |
const cObject* | operator[] (const char *objname) const |
bool | exist (int m) const |
bool | exist (const char *objname) const |
cObject* | remove (int m) |
cObject* | remove (const char *objname) |
cObject* | remove (cObject *obj) |
|
Copy constructor. Contained objects that are owned by cArray (that is, whose owner() is the cArray) will be duplicated so that the new cArray will have its own copy of them. |
|
Constructor. The initial size of the container and the delta (by which the size will grow if it gets full) can be specified. |
|
Destructor. The contained objects that were owned by the container will be deleted. |
|
Inserts the object into the array. Only the pointer of the object will be stored. The return value is the object's index in the array. |
|
Inserts the object into the array at the given position. If the position is occupied, the function throws cException. The return value is the object's index in the array. |
|
As a result, the container will be empty. Contained objects that were owned by the container will be deleted. |
|
Duplication and assignment work all right with cArray. Contained objects that are owned by cArray will be duplicated so that the new cArray will have its own copy of them. Reimplemented from cObject. |
|
Returns true if the array contains an object with the given name, otherwise false. |
|
Returns true if position m is used in the array, otherwise false. |
|
Returns the index of the first item in the array that has the name pointed to by s (cObject::isName() is used.) If no such item was found, -1 is returned. |
|
Searches the array for the pointer of the object passed and returns the index of the first match. If the object was not found, -1 is returned. |
|
Calls the given function for each object contained. Reimplemented from cObject. |
|
Returns reference to the first object in the array with name s. Returns NULL if no object with the given name was found. |
|
Returns reference to the mth object in the array. Returns NULL if the mth position is not used. |
|
Returns reference to the first object in the array with name s. Returns NULL if no object with the given name was found. |
|
Returns reference to the mth object in the array. Returns NULL if the mth position is not used. |
|
Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cObject. |
|
Returns the index of last used position+1. This is the same as the number of contained objects if there are no 'holes' in the array. (Removals may create holes.) |
|
Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. Duplication and assignment work all right with cArray. Contained objects that are owned by cArray will be duplicated so that the new cArray will have its own copy of them. |
|
The same as get(const char *). With the indexing operator, cArray can be used as a vector. |
|
The same as get(int). With the indexing operator, cArray can be used as a vector. |
|
The same as get(const char *). With the indexing operator, cArray can be used as a vector. |
|
The same as get(int). With the indexing operator, cArray can be used as a vector. |
|
Removes the object given with its index/name/pointer from the container, and returns the same pointer. If the object was not found, NULL is returned. (If the object was owned by the container, drop() is called.) |
|
Removes the object given with its index/name/pointer from the container. (If the object was owned by the container, drop() is called.) |
|
Removes the object given with its index/name/pointer from the container. (If the object was owned by the container, drop() is called.) |
|
Inserts the object into the array. If the array already contains an object with the same name, it will be replaced (hashtable-like behavior.) The replaced object, if it was owned by the container, is deleted using discard(). The return value is the object's index in the array. |