PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXTask
Class that implements a task.
#include <SFXTask.h.hpp>
class SFXTask;
SFMTYPEDEFCLASS(SFXTask)

Collaboration diagram

 Collaboration diagram of SFXTaskClass

Description

The SFXTask class is used to implement multitask processing.

class MyClass {
private:
    SFXTimer _task; 
public:
    Void Function(Void);
    CALLBACK_DECLARE_SFXTASK(OnTask)
};

Void MyClass::Function(Void) 
{

    ...

    // set information necessary to register a task
    _task.Set(CALLBACK_FUNCTION(OnTask));

    /// register a task
    _task.Schedule();
}

/// callback function
CALLBACK_IMPLEMENT_SFXTASK(MyClass, OnTask) 
{
    ...
}

Reference

SFXCallback | SFXTimer

Member

Constructor/Destructor
SFXTask( Void )
Constructor of SFXTask class.
~SFXTask( Void )
Destructor of SFXTask class.
Public Functions
Void Cancel( Void )
Cancel the registered tasks.
static
SFXTaskConstRef
EmptyInstance( Void )
Get an empty task.
SFXCallback::CallbackSPP GetProcedure( Void )
Get the callback function set to the task.
VoidPtr GetReference( Void )
Get user's data set to the task.
Bool IsValid( Void )
Check whether the task is registered or not.
SFCError Schedule( Void )
Schedule a task.
Void Set( SFXCallback::CallbackSPP spp , VoidPtr reference )
Set information necessary to register a task.

SFXTask::SFXTask
Constructor of SFXTask class.
[ public, explicit ]
SFXTask(Void);

SFXTask::~SFXTask
Destructor of SFXTask class.
[ public ]
~SFXTask(Void);

Description

In the destructor, cancel the registered tasks by using the SFXTask::Cancel function.

Reference

SFXTask::Cancel


SFXTask::Cancel
Cancel the registered tasks.
[ public ]
Void Cancel(Void);

Description

Cancel the registered tasks. If no task is registered, nothing will happen.

Reference

SFXTask::Set | SFXTask::Schedule


SFXTask::EmptyInstance
Get an empty task.
[ public, static ]
SFXTaskConstRef EmptyInstance(Void);

Description

Get an instance that represents an empty task.


SFXTask::GetProcedure
Get the callback function set to the task.
[ public, const ]
SFXCallback::CallbackSPP GetProcedure(Void);

Return value

Return the callback function set to the task.

Reference

SFXTask::GetReference | SFXTask::Set


SFXTask::GetReference
Get user's data set to the task.
[ public, const ]
VoidPtr GetReference(Void);

Return value

Return user's data set to the task.

Reference

SFXTask::GetProcedure | SFXTask::Set


SFXTask::IsValid
Check whether the task is registered or not.
[ public, const ]
Bool IsValid(Void);

Return value

  • If registered : true
  • Otherwise : false

Reference

SFXTask::Schedule


SFXTask::Schedule
Schedule a task.
[ public ]
SFCError Schedule(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If failed : SFERR_FAILED

Description

When the task is registered, the callback function set to the task will be called in the next event loop.

If the task has already been registered, it will be canceled and registered again.

Reference

SFXTask::Cancel | SFXTask::Set


SFXTask::Set
Set information necessary to register a task.
[ public ]
Void Set(
    SFXCallback::CallbackSPP spp   // callback function
    VoidPtr reference              // user's data
);

Reference

SFXTask::GetProcedure | SFXTask::GetReference