Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

events.hh File Reference

#include "tools.hh"

Include dependency graph for events.hh:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class  EventQueue
class  QueueEvent

Defines

#define MAXVALUE   0x7ffffff
#define RAND_MAX   2147483647

Typedefs

typedef long handle

Functions

int TimevalCmp (struct timeval *x, struct timeval *y)
void TimevalSub (struct timeval *x, struct timeval *y, struct timeval *tv)
void TimevalAddusecs (struct timeval *tv, int usecs)


Define Documentation

#define MAXVALUE   0x7ffffff
 

Definition at line 40 of file events.hh.

Referenced by EventQueue::eqNextTimer(), and DiffusionRouting::run().

#define RAND_MAX   2147483647
 

Definition at line 124 of file events.hh.

Referenced by GeoRoutingFilter::broadcastHeuristicValue(), GradientFilter::forwardExploratoryData(), GradientFilter::forwardPushExploratoryData(), DiffusionRouting::interestTimeout(), GeoRoutingFilter::preProcessFilter(), GradientFilter::processNewMessage(), EventQueue::randDelay(), GeoRoutingFilter::sendNeighborRequest(), and GradientFilter::sendPositiveReinforcement().


Typedef Documentation

typedef long handle
 

Definition at line 39 of file events.hh.


Function Documentation

void TimevalAddusecs struct timeval *  tv,
int  usecs
 

Definition at line 58 of file events.cc.

Referenced by EventQueue::setDelay().

00059 {
00060   tv->tv_usec += usecs;
00061   if (tv->tv_usec > 1000000){
00062     tv->tv_sec += tv->tv_usec / 1000000;
00063     tv->tv_usec = tv->tv_usec % 1000000;
00064   }
00065 }

int TimevalCmp struct timeval *  x,
struct timeval *  y
 

Definition at line 32 of file events.cc.

Referenced by EventQueue::eqTopInPast(), EventQueue::eventCmp(), DiffusionRouting::run(), DiffusionRouting::send(), and TimevalSub().

00033 {
00034   if (x->tv_sec > y->tv_sec) return 1;
00035   if (x->tv_sec < y->tv_sec) return -1;
00036   if (x->tv_usec > y->tv_usec) return 1;
00037   if (x->tv_usec < y->tv_usec) return -1;
00038   return 0;
00039 }

void TimevalSub struct timeval *  x,
struct timeval *  y,
struct timeval *  tv
 

Definition at line 41 of file events.cc.

References TimevalCmp().

Referenced by EventQueue::eqNextTimer().

00042 {
00043   if (TimevalCmp(x, y) < 0) 
00044     tv->tv_sec = tv->tv_usec = 0;
00045   else{
00046     *tv = *x;
00047     // borrow..
00048     if (tv->tv_usec < y->tv_usec){
00049       tv->tv_usec += 1000000;
00050       tv->tv_sec--;
00051     }
00052     // sub
00053     tv->tv_usec -= y->tv_usec;
00054     tv->tv_sec -= y->tv_sec;
00055   }
00056 }

Here is the call graph for this function:


Generated on Tue Apr 20 12:20:04 2004 for NS2.26SourcesOriginal by doxygen 1.3.3