OpenWalnut
1.5.0dev
|
Derived WDeferredCallEvent allowing result values in calls. More...
#include <WDeferredCallEvent.h>
Public Member Functions | |
WDeferredCallResultEvent (boost::function< Result(void) > function, Result *result, WCondition::SPtr notify=WCondition::SPtr()) | |
Constructor. More... | |
virtual | ~WDeferredCallResultEvent () |
Destructor. More... | |
Public Member Functions inherited from WDeferredCallEventBase | |
WDeferredCallEventBase (WCondition::SPtr notify=WCondition::SPtr()) | |
Constructor. More... | |
virtual | ~WDeferredCallEventBase () |
Destructor. More... | |
void | call () |
Call the function. More... | |
WConditionOneShot::SPtr | getDoneCondition () const |
Get the condition that notifies about the finished execution of the specified function. More... | |
Protected Member Functions | |
virtual void | callImpl () |
Call the function. More... | |
Private Attributes | |
Result * | m_result |
The result. More... | |
boost::function< Result(void) > | m_function |
the title of the widget to create More... | |
Additional Inherited Members | |
Static Public Attributes inherited from WDeferredCallEventBase | |
static const QEvent::Type | CUSTOM_TYPE = static_cast< QEvent::Type >( WQT_DEFERREDCALL ) |
Constant which saves the number used to distinguish this event from other custom events. More... | |
Protected Attributes inherited from WDeferredCallEventBase | |
WCondition::SPtr | m_callCondition |
Fired whenever the function was called. More... | |
Derived WDeferredCallEvent allowing result values in calls.
Result | return type |
Definition at line 108 of file WDeferredCallEvent.h.
|
inline |
Constructor.
function | the function to call |
result | a pointer to store the result in. Can be NULL if you are not interested in the result. You need to alloc and free it. The reason for using an external pointer is that Qt doc tells us that you loose ownership on QEvents when using QCoreApplication::postEvent. The Event will be deleted after being processed, thus we cannot ensure safe access to members after posting the event. |
notify | specify your own condition to wait for. This is needed since the QApplication doc tells us that ownership of an event is handed over to QT and that it is not save to use the event after posting it. This means we cannot utilize an internal condition in the event as it might be deleted already when calling wait() on it. Do not specify this variable to get a fire-and-forget call. |
Definition at line 122 of file WDeferredCallEvent.h.
|
inlinevirtual |
Destructor.
Definition at line 132 of file WDeferredCallEvent.h.
|
inlineprotectedvirtual |
Call the function.
Implements WDeferredCallEventBase.
Definition at line 141 of file WDeferredCallEvent.h.
References WDeferredCallResultEvent< Result >::m_function, and WDeferredCallResultEvent< Result >::m_result.
|
private |
the title of the widget to create
Definition at line 161 of file WDeferredCallEvent.h.
Referenced by WDeferredCallResultEvent< Result >::callImpl(), and WDeferredCallResultEvent< void >::callImpl().
|
private |
The result.
Definition at line 156 of file WDeferredCallEvent.h.
Referenced by WDeferredCallResultEvent< Result >::callImpl().