Professional Documents
Culture Documents
+
Step by Step
Part - 6
By
Mohammed Amer AlBatati
Queues
cQueue is a container class that acts as a queue.
The basic cQueue member functions:
insert(obj), inserts an object into the queue head.
pop(), returns and removes object from the front.
remove(obj), removes that object from the queue.
length(), returns the number of items in the queue.
empty(), tells whether there is anything in the
queue.
insertBefore(obj_where, obj_what)
insertAfter(obj_where, obj_what)
front(), returns pointer to the object at the front.
back() , returns pointer to the object at the back.
Queues cont.
cQueue Example:
Iterators
Expandable Array
cArray is a container class that holds objects derived from cObject.
cArray works as an array, but it grows automatically when it
becomes full.
The basic usage:
cArray array("array"); // Creating an array
int index = array.add( obj ); // Adding an object
int index = array.find(obj);// Finding an object
array.remove (obj)// Remove an object
Iteration
and scalars.
output vectors are to record time series data
and output scalars are supposed to record a
single value per simulation run.
Lets record the node power after every
transmission operation. To do that add the
following:
1.
2.
3.
Output Vectors
A folder called results will be generated.
(.anf).
Select result as parent folder -> name it-> click
finish.
Histograms
You may want to record the distribution as a
for example:
hData.getCount(), hData.getMin(),
hData.getMax(), hData.getMean(),
hData.getStddev(), hData.getVariance(),
hData.getSum(), hData.getSqrSum().
Output Scalars
Lets record node life time, which is the time
2. At Node.cc
Sequence Chart
ELOG files will be generated.
chart.