16 #ifndef __OMNETPP_CARRAY_H 17 #define __OMNETPP_CARRAY_H 19 #include "cownedobject.h" 74 void init(
const cArray& a,
bool atHead=
true);
90 bool end()
const {
return k<0 || k>=array->
size();}
122 enum {FL_TKOWNERSHIP = 4};
130 void copy(
const cArray& other);
147 explicit cArray(
const char *name=
nullptr,
int capacity=0,
int delta=10);
179 virtual std::string str()
const override;
185 virtual void forEachChild(
cVisitor *v)
override;
192 virtual void parsimPack(
cCommBuffer *buffer)
const override;
199 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
210 virtual int size()
const {
return last+1;}
216 virtual void clear();
227 virtual void setCapacity(
int capacity);
241 virtual int addAt(
int m,
cObject *obj);
257 virtual int find(
cObject *obj)
const;
264 virtual int find(
const char *objname)
const;
276 virtual cObject *
get(
const char *objname);
282 virtual const cObject *
get(
int m)
const;
288 virtual const cObject *
get(
const char *objname)
const;
317 virtual bool exist(
int m)
const {
return m>=0 && m<=last && vect[m]!=
nullptr;}
323 virtual bool exist(
const char *objname)
const {
return find(objname)!=-1;}
330 virtual cObject *
remove(
int m);
337 virtual cObject *
remove(
const char *objname);
Iterates through elements in a cArray, skipping holes (slots containing nullptr). ...
Definition: carray.h:53
Iterator operator--(int)
Definition: carray.h:118
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
virtual bool exist(int m) const
Definition: carray.h:317
Iterator operator++(int)
Definition: carray.h:104
void setTakeOwnership(bool tk)
Definition: carray.h:368
virtual cArray * dup() const override
Definition: carray.h:173
Vector-like container for objects derived from cObject.
Definition: carray.h:38
Iterator & operator++()
Definition: carray.h:97
cObject * operator[](int m)
Definition: carray.h:294
bool end() const
Definition: carray.h:90
bool getTakeOwnership() const
Definition: carray.h:375
_OPPDEPRECATED cObject * operator()() const
Definition: carray.h:85
virtual bool exist(const char *objname) const
Definition: carray.h:323
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
virtual int getCapacity() const
Definition: carray.h:221
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:104
const cObject * operator[](const char *objname) const
Definition: carray.h:312
virtual cObject * get(int m)
const cObject * operator[](int m) const
Definition: carray.h:306
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
cObject * operator[](const char *objname)
Definition: carray.h:300
Definition: cabstracthistogram.h:21
Iterator & operator--()
Definition: carray.h:111
virtual int size() const
Definition: carray.h:210
cObject * operator*() const
Definition: carray.h:80
Iterator(const cArray &a, bool atHead=true)
Definition: carray.h:69