Main Page Modules Class Hierarchy Compound List File List Compound Members
cBag Class Reference
#include <carray.h>
Inheritance diagram for cBag::
List of all members.
Detailed Description
Container class to hold small non-class items (int, double, etc). cBag stores full copy of each item inserted and NOT the pointer.
cBag is a container class which is designed to hold non-cObject items without constructors/destructors (ints, doubles, small structs etc.). cBag stores full, bit-by-bit copies of the items inserted (and not the pointers). cBag works as an array, but if it gets full, it grows automatically by a specified delta.
Constructor & Destructor Documentation
cBag::cBag (
|
const cBag & bag )
|
|
cBag::cBag (
|
const char * name = NULL,
|
|
int esiz = 4,
|
|
int siz = 0,
|
|
int delt = 5 ) [explicit]
|
|
|
Constructor. Parameters are: name, the size of elements in bytes, the initial size of the container and the delta (by which the size will grow if it gets full). |
cBag::~cBag (
|
) [inline, virtual]
|
|
|
Destructor. The items in the object will be deleted. |
Member Function Documentation
int cBag::add (
|
void * obj )
|
|
|
Inserts a new item into the array. A copy will be made of the item pointed to by data. The return value is the item's index in the array. |
int cBag::addAt (
|
int m,
|
|
void * obj )
|
|
|
Inserts a new item into the array at the given position. |
|
Clears the whole contents of the cBag. |
cObject * cBag::dup (
|
) const [inline, virtual]
|
|
|
Creates and returns an exact copy of this object. See cObject for more details.
Reimplemented from cObject. |
int cBag::find (
|
void * obj ) const
|
|
|
Returns the index of the first item in the array that equals the item pointed to by obj. The comparison is done byte-by-byte. If no such item was found, -1 is returned. |
const void * cBag::get (
|
int m ) const
|
|
|
Returns a pointer to the mth item in the array or NULL if the mth position is not used. |
void * cBag::get (
|
int m )
|
|
|
Returns a pointer to the mth item in the array or NULL if the mth position is not used. |
void cBag::info (
|
char * buf ) [virtual]
|
|
|
Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details.
Reimplemented from cObject. |
bool cBag::isUsed (
|
int m ) const
|
|
|
Returns true if the mth position exists and an item was inserted there. |
int cBag::items (
|
) const [inline]
|
|
|
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.) |
int cBag::netPack (
|
) [virtual]
|
|
|
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. |
int cBag::netUnpack (
|
) [virtual]
|
|
|
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. |
cBag & cBag::operator= (
|
const cBag & bag )
|
|
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. Duplication and assignment work all right with cBag. |
const void * cBag::operator[] (
|
int m ) const [inline]
|
|
|
The same as get(int m). With the indexing operator, cBag can be used as a vector. |
void * cBag::operator[] (
|
int m ) [inline]
|
|
|
The same as get(int m). With the indexing operator, cBag can be used as a vector. |
void * cBag::remove (
|
int m )
|
|
|
FIXME: Remove item at position m and return its pointer. (???) |
void cBag::setup (
|
int esiz,
|
|
int siz,
|
|
int delt = 5 )
|
|
|
Clears the current contents and changes element size, initial array size and delta parameters. |
The documentation for this class was generated from the following file:
Generated at Mon Jun 16 23:37:32 2003 for OMNeT++ by
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001