OMNeT++ Simulation Library
6.0.3
|
16 #ifndef __OMNETPP_CQUEUE_H
17 #define __OMNETPP_CQUEUE_H
19 #include "cownedobject.h"
97 void init(
const cQueue& q,
bool reverse=
false) {p = reverse ? q.backp : q.frontp;}
107 bool end()
const {
return p ==
nullptr;}
138 friend class Iterator;
141 bool takeOwnership =
true;
142 QElem *frontp =
nullptr, *backp =
nullptr;
144 Comparator *comparator =
nullptr;
147 void copy(
const cQueue& other);
151 QElem *find_qelem(
cObject *obj)
const;
152 void insbefore_qelem(QElem *p,
cObject *obj);
153 void insafter_qelem(QElem *p,
cObject *obj);
154 cObject *remove_qelem(QElem *p);
163 cQueue(
const char *name=
nullptr, Comparator *cmp=
nullptr);
168 cQueue(
const char *name, CompareFunc cmp);
205 virtual std::string str()
const override;
211 virtual void forEachChild(
cVisitor *v)
override;
218 virtual void parsimPack(
cCommBuffer *buffer)
const override;
225 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
234 virtual void setup(Comparator *cmp);
240 virtual void setup(CompareFunc cmp);
246 virtual void insert(
cObject *obj);
278 virtual void clear();
288 virtual cObject *front()
const;
300 virtual int getLength()
const;
310 [[deprecated(
"use getLength() instead")]]
int length()
const {
return getLength();}
315 [[deprecated(
"use isEmpty() instead")]]
bool empty()
const {
return isEmpty();}
322 virtual cObject *get(
int i)
const;
327 virtual bool contains(
cObject *obj)
const;
int length() const
Definition: cqueue.h:310
int(* CompareFunc)(cObject *a, cObject *b)
Function for comparing two cObjects, used by cQueue for priority queuing.
Definition: cqueue.h:76
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
Iterator operator--(int)
Definition: cqueue.h:135
void setTakeOwnership(bool tk)
Definition: cqueue.h:345
virtual cQueue * dup() const override
Definition: cqueue.h:199
Iterator & operator++()
Definition: cqueue.h:114
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
bool empty() const
Definition: cqueue.h:315
Iterator operator++(int)
Definition: cqueue.h:121
Base class for object comparators, used by cQueue for priority queuing.
Definition: cqueue.h:57
bool isEmpty() const
Definition: cqueue.h:305
bool end() const
Definition: cqueue.h:107
Iterator & operator--()
Definition: cqueue.h:128
cObject * operator*() const
Definition: cqueue.h:102
void init(const cQueue &q, bool reverse=false)
Definition: cqueue.h:97
Walks along a cQueue.
Definition: cqueue.h:81
bool getTakeOwnership() const
Definition: cqueue.h:352
Queue class for objects derived from cObject.
Definition: cqueue.h:42
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
Iterator(const cQueue &q, bool reverse=false)
Definition: cqueue.h:92
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:105