Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ActiveNotifier Class Reference

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

Inheritance diagram for ActiveNotifier:
Notifier

Public Member Functions

 ActiveNotifier (SearchOp op=SEARCH_STOP)
 Construct an ActiveNotifier.
 
 ~ActiveNotifier ()
 Destroy an ActiveNotifier.
 
int add_activate_callback (callback_type f, void *v)
 Register an activate callback with this Notifier.
 
void remove_activate_callback (callback_type f, void *v)
 Unregister an activate callback with this Notifier.
 
void listeners (Vector< Task * > &v) const
 Return the listener list.
 
void set_active (bool active, bool schedule=true)
 Set the associated signal's activity, possibly scheduling any listener tasks.
 
void wake ()
 Set the associated signal to active and schedule any listener tasks.
 
void sleep ()
 Set the associated signal to inactive.
 
- Public Member Functions inherited from Notifier
 Notifier (SearchOp op=SEARCH_STOP)
 Constructs a Notifier.
 
 Notifier (const NotifierSignal &signal, SearchOp op=SEARCH_STOP)
 Constructs a Notifier associated with a given signal.
 
virtual ~Notifier ()
 Destruct a Notifier.
 
bool initialized () const
 Return whether the Notifier is initialized.
 
int initialize (const char *name, Router *router)
 Initialize the associated NotifierSignal, if necessary.
 
const NotifierSignal & signal () const
 Return this Notifier's associated NotifierSignal.
 
SearchOp search_op () const
 Return this Notifier's search operation.
 
bool active () const
 Returns whether the associated signal is active.
 
bool safe_active () const
 Returns whether the associated signal is active.
 
bool set_active (bool active)
 Set the associated signal's activity.
 
void wake ()
 Set the associated signal to active.
 
void sleep ()
 Set the associated signal to inactive.
 
int add_listener (Task *task)
 Register a listener with this Notifier.
 
void remove_listener (Task *task)
 Unregister a listener with this Notifier.
 
int add_dependent_signal (NotifierSignal *signal)
 Register a dependent signal with this Notifier.
 
void remove_dependent_signal (NotifierSignal *signal)
 Unregister a dependent signal with this Notifier.
 

Additional Inherited Members

- Public Types inherited from Notifier
enum  SearchOp { SEARCH_STOP = 0 , SEARCH_CONTINUE , SEARCH_CONTINUE_WAKE }
 
typedef void(* callback_type) (void *, Notifier *)
 
- Static Public Member Functions inherited from Notifier
static NotifierSignal upstream_empty_signal (Element *e, int port)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal upstream_empty_signal (Element *e, int port, Task *task)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal upstream_empty_signal (Element *e, int port, Notifier *dependent_notifier)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal upstream_signal (Element *e, int port, Task *task, const char *signal)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal upstream_empty_signal (Element *e, int port, callback_type f, void *user_data)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal upstream_signal (Element *e, int port, callback_type f, void *user_data, const char *signal)
 Calculate and return the NotifierSignal derived from all empty notifiers upstream of element e's input port.
 
static NotifierSignal downstream_full_signal (Element *e, int port)
 Calculate and return the NotifierSignal derived from all full notifiers downstream of element e's output port.
 
static NotifierSignal downstream_full_signal (Element *e, int port, Task *task)
 Calculate and return the NotifierSignal derived from all full notifiers downstream of element e's output port.
 
static NotifierSignal downstream_full_signal (Element *e, int port, Notifier *dependent_notifier)
 Calculate and return the NotifierSignal derived from all full notifiers downstream of element e's output port.
 
static NotifierSignal downstream_full_signal (Element *e, int port, callback_type f, void *user_data)
 Calculate and return the NotifierSignal derived from all full notifiers downstream of element e's output port.
 
static NotifierSignal upstream_empty_signal (Element *e, int port, int)
 
static NotifierSignal upstream_empty_signal (Element *e, int port, int, Notifier *)
 
static NotifierSignal downstream_full_signal (Element *e, int port, int)
 
static NotifierSignal downstream_full_signal (Element *e, int port, int, Notifier *)
 
- Static Public Attributes inherited from Notifier
static const char EMPTY_NOTIFIER [] = "empty"
 
static const char FULL_NOTIFIER [] = "full"
 

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.

Constructor & Destructor Documentation

◆ ActiveNotifier()

ActiveNotifier::ActiveNotifier ( SearchOp  op = SEARCH_STOP)

Construct an ActiveNotifier.

Parameters
opcontrols notifier path search

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

◆ ~ActiveNotifier()

ActiveNotifier::~ActiveNotifier ( )

Destroy an ActiveNotifier.

Member Function Documentation

◆ add_activate_callback()

int ActiveNotifier::add_activate_callback ( callback_type  f,
void *  user_data 
)
virtual

Register an activate callback with this Notifier.

Parameters
fcallback function
user_datacallback data for f
Returns
1 if notifier was added, 0 on other success, negative on error

When this Notifier's associated signal is activated, this Notifier should call f(user_data, this). Not all types of Notifier provide this functionality. The default implementation does nothing.

If f is null, then user_data is a Task pointer passed to add_listener.

See also
remove_activate_callback, add_listener, add_dependent_signal

Reimplemented from Notifier.

◆ remove_activate_callback()

void ActiveNotifier::remove_activate_callback ( callback_type  f,
void *  user_data 
)
virtual

Unregister an activate callback with this Notifier.

Parameters
fcallback function
user_datacallback data for f

Undoes the effect of all prior add_activate_callback(f, user_data) calls. Does nothing if (f,user_data) was never added. The default implementation does nothing.

If f is null, then user_data is a Task pointer passed to remove_listener.

See also
add_activate_callback

Reimplemented from Notifier.

◆ listeners()

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

Return the listener list.

Parameters
[out]vcollects listener tasks

Pushes all listener Task objects onto the end of v.

◆ set_active()

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

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

never

Parameters
activetrue iff the signal should be active
scheduleif 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

◆ wake()

void ActiveNotifier::wake ( )
inline

Set the associated signal to active and schedule any listener tasks.

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

See also
set_active, add_listener

◆ sleep()

void ActiveNotifier::sleep ( )
inline

Set the associated signal to inactive.

See also
set_active

The documentation for this class was generated from the following files: