ActiveNotifier Class Reference

Inheritance diagram for ActiveNotifier:

Notifier List of all members.

Detailed Description

A basic activity signal and notification provider that can reschedule any dependent Task objects.

ActiveNotifier, whose base class is Notifier, combines a basic activity signal with the ability to wake up any dependent Task objects when that signal becomes active. Notifier clients are called listeners. Each listener corresponds to a Task object. The listener generally goes to sleep -- i.e., becomes unscheduled -- when it runs out of work and the corresponding activity signal is inactive. The ActiveNotifier class will wake up the listener when it becomes active by rescheduling the relevant Task.

Elements that contain ActiveNotifier objects will generally override Element::cast() or Element::port_cast(), allowing other parts of the configuration to find the Notifiers.


Public Member Functions

 ActiveNotifier (SearchOp op=SEARCH_STOP)
 Construct an ActiveNotifier.
 ~ActiveNotifier ()
 Destroy an ActiveNotifier.
int add_listener (Task *task)
 Add a listener to this notifier.
void remove_listener (Task *task)
 Remove a listener from this notifier.
int add_dependent_signal (NotifierSignal *signal)
 Add a dependent signal to this Notifier.
void listeners (Vector< Task * > &v) const
 Return the listener list.
void set_active (bool active, bool schedule=true)
 Sets the associated signal's activity, possibly scheduling any listener tasks.
void wake ()
 Sets the associated signal to active and schedules any listener tasks.
void sleep ()
 Sets the associated signal to inactive.

Classes

union  task_or_signal_t


Constructor & Destructor Documentation

ActiveNotifier::ActiveNotifier ( SearchOp  op = SEARCH_STOP  ) 

Construct an ActiveNotifier.

Parameters:
op controls notifier path search
Constructs an ActiveNotifier object, analogous to the Notifier::Notifier(SearchOp) constructor. (See that constructor for more information on op.)

ActiveNotifier::~ActiveNotifier (  ) 

Destroy an ActiveNotifier.


Member Function Documentation

int ActiveNotifier::add_listener ( Task task  )  [virtual]

Add a listener to this notifier.

Parameters:
task the listener to add
Adds task to this notifier's listener list (the clients interested in notification). Whenever the ActiveNotifier activates its signal, task will be rescheduled.

Reimplemented from Notifier.

void ActiveNotifier::remove_listener ( Task task  )  [virtual]

Remove a listener from this notifier.

Parameters:
task the listener to remove
Removes task from this notifier's listener list (the clients interested in notification). task will not be rescheduled when the Notifier is activated.

Reimplemented from Notifier.

int ActiveNotifier::add_dependent_signal ( NotifierSignal signal  )  [virtual]

Add a dependent signal to this Notifier.

Parameters:
signal the dependent signal
Adds signal as a dependent signal to this notifier. Whenever the ActiveNotifier activates its signal, signal will be activated as well.

Reimplemented from Notifier.

void ActiveNotifier::listeners ( Vector< Task * > &  v  )  const

Return the listener list.

Parameters:
[out] v collects listener tasks
Pushes all listener Task objects onto the end of v.

void ActiveNotifier::set_active ( bool  active,
bool  schedule = true 
) [inline]

Sets the associated signal's activity, possibly scheduling any listener tasks.

Parameters:
active true iff the signal should be active
schedule if true, wake up listener tasks
If active and schedule are both true, and the signal was previously inactive, then any listener Tasks are scheduled with Task::reschedule().

See also:
wake, sleep, add_listener

void ActiveNotifier::wake (  )  [inline]

Sets the associated signal to active and schedules any listener tasks.

If the signal was previously inactive, then any listener Tasks are scheduled with Task::reschedule().

See also:
set_active, add_listener

Reimplemented from Notifier.

void ActiveNotifier::sleep (  )  [inline]

Sets the associated signal to inactive.

See also:
set_active

Reimplemented from Notifier.


The documentation for this class was generated from the following files:
Generated on Tue Mar 2 12:25:47 2010 for Click by  doxygen 1.5.1