// -*- c-basic-offset: 4 -*- #ifndef CLICK_SCHEDORDERTEST_HH #define CLICK_SCHEDORDERTEST_HH #include #include #include "elements/standard/simplequeue.hh" CLICK_DECLS /* =c SchedOrderTest(ID, [ SIZE, LIMIT, STOP]) =s test remembers scheduling order =d SchedOrderTest elements repeatedly schedule themselves, and keep track of the order in which they were scheduled. ID is an integer used to distinguish between different SchedOrderTest elements. The "order" handler reports the sequence of IDs corresponding to the order in which the first SIZE SchedOrderTest tasks were scheduled. Use ScheduleInfo to set SchedOrderTest's tickets. =over 8 =item SIZE Integer. The maximum length of the stored ID sequence. Default is 1024. =item LIMIT Unsigned. SchedOrderTest will schedule itself at most LIMIT times. 0 means forever. Default is 0. =item STOP Boolean. If true, SchedOrderTest will stop the driver when the ID sequence is full. (Note that this has to do with SIZE, not LIMIT.) Default is false. =h order read-only Reports the ID sequence as a space-separated list of integers. =a ScheduleInfo */ class SchedOrderTest : public Element { public: SchedOrderTest(); ~SchedOrderTest(); const char *class_name() const { return "SchedOrderTest"; } const char *port_count() const { return PORTS_0_0; } const char *processing() const { return AGNOSTIC; } int configure(Vector &, ErrorHandler *); int initialize(ErrorHandler *); void add_handlers(); bool run_task(); private: int _id; uint32_t _count; uint32_t _limit; int** _bufpos_ptr; int* _buf_begin; int* _bufpos; int* _buf_end; int _bufsiz; Task _task; bool _stop; static String read_handler(Element*, void*); }; CLICK_ENDDECLS #endif