ns-allinone-2.35/ns-2.35/common/scheduler.cc
void 
Scheduler::schedule(Handler* h, Event* e, double delay)
{
	// handler should ALWAYS be set... if it's not, it's a bug in the caller
	if (!h) {
		fprintf(stderr,
			"Scheduler: attempt to schedule an event with a NULL handler."
			"  Don't DO that at time %f\n", clock_);
		abort();
	};
	
	if (e->uid_ > 0) {
		printf("Scheduler: Event UID not valid!\n\n");
		abort();
	}
	
	if (delay < 0) {
		// You probably don't want to do this
		// (it probably represents a bug in your simulation).
		fprintf(stderr, 
			"warning: ns Scheduler::schedule: scheduling event\n\t"
			"with negative delay (%f) at time %f.\n", delay, clock_);
	}

	if (uid_ < 0) {
		fprintf(stderr, "Scheduler: UID space exhausted!\n");
		abort();
	}
	e->uid_ = uid_++;
	e->handler_ = h;
	double t = clock_ + delay;

	e->time_ = t;
	insert(e);
}
/*
 * Schedule an event delay time units into the future.
 * The event will be dispatched to the specified handler.
 * We use a relative time to avoid the problem of scheduling
 * something in the past.
 *
 * Scheduler::schedule does a fair amount of error checking
 * because debugging problems when events are triggered
 * is much harder (because we've lost all context about who did
 * the scheduling).
 */
Schedule an event delay time units into the future.
The event will be dispatched to the specified handler.
We use a relative time to avoid the problem of scheduling
something in the past.

:schedule does a fair amount of error checking
because debugging problems when events are triggered
is much harder (because we've lost all context about who did
the scheduling).
Schedule an event delay time units into the future . The event will be dispatched to the specified handler . We use a relative time to avoid the problem of scheduling something in the past . : schedule does a fair amount of error checking because debugging problems when events are triggered is much harder ( because we ' ve lost all context about who did the scheduling ) .
void 
Scheduler::schedule(Handler* h, Event* e, double delay)
{
	if (!h) {
		fprintf(stderr,
			"Scheduler: attempt to schedule an event with a NULL handler."
			"  Don't DO that at time %f\n", clock_);
		abort();
	};
	if (e->uid_ > 0) {
		printf("Scheduler: Event UID not valid!\n\n");
		abort();
	}
	if (delay < 0) {
		fprintf(stderr, 
			"warning: ns Scheduler::schedule: scheduling event\n\t"
			"with negative delay (%f) at time %f.\n", delay, clock_);
	}
	if (uid_ < 0) {
		fprintf(stderr, "Scheduler: UID space exhausted!\n");
		abort();
	}
	e->uid_ = uid_++;
	e->handler_ = h;
	double t = clock_ + delay;
	e->time_ = t;
	insert(e);
}
void Scheduler :: schedule ( Handler * h , Event * e , double delay ) { if ( ! h ) { fprintf ( stderr , " " " \n " , clock_ ) ; abort ( ) ; } ; if ( e -> uid_ > 0 ) { printf ( " \n \n " ) ; abort ( ) ; } if ( delay < 0 ) { fprintf ( stderr , " \n \t " " \n " , delay , clock_ ) ; } if ( uid_ < 0 ) { fprintf ( stderr , " \n " ) ; abort ( ) ; } e -> uid_ = uid_ ++ ; e -> handler_ = h ; double t = clock_ + delay ; e -> time_ = t ; insert ( e ) ; }
Schedule an event delay time units into the future.
Schedule an event delay time units into the future .
// handler should ALWAYS be set... if it's not, it's a bug in the caller // You probably don't want to do this // (it probably represents a bug in your simulation).