what does this Task * mean???

The code is like following, Task is a class,what does that (Task *) mean here??

class InfiniteSource { ...
bool run_task(Task *t);
private:
Task _task;
};

InfiniteSource::InfiniteSource() : _task(this) {
}

int InfiniteSource::initialize(ErrorHandler *errh) {
ScheduleInfo::initialize_task(this, &_task, errh);
return 0;
}

bool InfiniteSource::run_task(Task *) {
Packet *p = ... generate packet ...;
output(0).push(p);
if (packets left to send)
_task.fast_reschedule();
return true; // the task did useful work
}
Last edited on
It's a pointer to a Task object.
but why there is no parameter appeared???
It means that although you pass a Task*, they never use it (and thus don't have to name it). Kind of dumb to have a parameter that you don't use though.
If you don‘t use it,why bother pass it????
Ask the one who wrote that code or check the documentation (if there is one) to see what the parameter's purpose is.
Something like this can happen when you override a virtual function, but don't care about its parameter. However, since InfiniteSource apparently doesn't inherit from anything, this doesn't seem to be the case here.
Topic archived. No new replies allowed.