KTutorial  0.5.1
Public Slots | Public Member Functions | Protected Member Functions
ktutorial::WaitForComposed Class Reference

Abstract base class for composed conditions to wait for. More...

#include <WaitForComposed.h>

Inheritance diagram for ktutorial::WaitForComposed:
Inheritance graph
[legend]
Collaboration diagram for ktutorial::WaitForComposed:
Collaboration graph
[legend]

List of all members.

Public Slots

void childWaitEnd (WaitFor *waitFor)
 Notifies that the child WaitFor object has ended its wait.

Public Member Functions

virtual ~WaitForComposed ()
 Destroys this WaitForComposed.
virtual void setActive (bool active)
 Sets this WaitForComposed and all the children as active or inactive.
Q_INVOKABLE void add (WaitFor *waitFor)
 Adds a new WaitFor to this WaitForComposed.

Protected Member Functions

 WaitForComposed ()
 Creates a new WaitForComposed.
QList< WaitFor * > & waitFors () const
 Returns a list containing all the WaitFor objects added.

Detailed Description

Abstract base class for composed conditions to wait for.

Classes derived from this one model a composed condition to be waited for. Child WaitFor objects are added using WaitForComposed::add(WaitFor*).

Once a WaitFor is added, it will be automatically activated or deactivated when the parent (the subclass of WaitForComposed) is activated or deactivated.

When an added WaitFor ends its wait, it notifies the parent WaitForComposed subclass. It then checks if it is active and its own condition was met, and in that case ends its own wait.

When subclassing WaitForComposed, conditionMet() must be implemented.

Definition at line 45 of file WaitForComposed.h.


Constructor & Destructor Documentation

Creates a new WaitForComposed.

Protected to avoid classes other than subclasses to create them.

Definition at line 72 of file WaitForComposed.cpp.


Member Function Documentation

Adds a new WaitFor to this WaitForComposed.

If the WaitFor is already added, nothing happens. WaitFor notifies this WaitForComposed when its wait ends through WaitForComposed::childWaitEnd(WaitFor*)

The WaitFor is reparented to this WaitForComposed, and thus deleted when this WaitForComposed is deleted.

This method can be invoked from a script.

Parameters:
waitForThe WaitFor to add.

Definition at line 42 of file WaitForComposed.cpp.

References childWaitEnd(), ktutorial::WaitForComposedPrivate::mWaitFors, and ktutorial::WaitFor::waitEnded().

Notifies that the child WaitFor object has ended its wait.

If is active and the condition is met for this WaitForComposed, its own wait ends.

This slot is connected automatically to children when they are added.

Parameters:
waitForThe WaitFor child object that ended its wait.

Definition at line 56 of file WaitForComposed.cpp.

References ktutorial::WaitFor::conditionMet(), ktutorial::WaitFor::isActive(), ktutorial::WaitForComposedPrivate::mWaitFors, and ktutorial::WaitFor::waitEnded().

Referenced by add().

void ktutorial::WaitForComposed::setActive ( bool  active) [virtual]

Sets this WaitForComposed and all the children as active or inactive.

Parameters:
activeTrue to set it active, false otherwise.

Reimplemented from ktutorial::WaitFor.

Definition at line 33 of file WaitForComposed.cpp.

References ktutorial::WaitForComposedPrivate::mWaitFors.

QList< WaitFor * > & ktutorial::WaitForComposed::waitFors ( ) const [protected]

Returns a list containing all the WaitFor objects added.

Returns:
All the WaitFor objects added.

Definition at line 76 of file WaitForComposed.cpp.

References ktutorial::WaitForComposedPrivate::mWaitFors.

Referenced by ktutorial::WaitForAnd::conditionMet(), and ktutorial::WaitForOr::conditionMet().


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