Async 1.8.0
Async::Application Class Referenceabstract

The base class for asynchronous applications. More...

#include <AsyncApplication.h>

Inheritance diagram for Async::Application:
Async::CppApplication Async::QtApplication

Public Member Functions

 Application (void)
 Default constructor.
 
virtual ~Application (void)
 Destructor.
 
virtual void exec (void)=0
 Execute the application main loop.
 
virtual void quit (void)=0
 Exit the application main loop.
 
void runTask (sigc::slot< void > task)
 Run a task from the Async main loop.
 

Static Public Member Functions

static Applicationapp (void)
 Get the one and only application instance.
 

Protected Member Functions

void clearTasks (void)
 

Friends

class FdWatch
 
class Timer
 
class DnsLookup
 

Detailed Description

The base class for asynchronous applications.

This is the base class for all asynchronous applications. It is an abstract class and so it must be inherited from to create a class that can be instantiated.

Definition at line 119 of file AsyncApplication.h.

Constructor & Destructor Documentation

◆ Application()

Async::Application::Application ( void )

Default constructor.

◆ ~Application()

virtual Async::Application::~Application ( void )
virtual

Destructor.

Member Function Documentation

◆ app()

static Application & Async::Application::app ( void )
static

Get the one and only application instance.

Use this static member function to get the one and only instance of the application object. If an application object has not been previously created, the application will crash with a failed assertion.

Returns
Returns a reference to the applicaton instance
Examples
AsyncAudioContainer_demo.cpp.

Referenced by Async::TaskRunner::cancel(), Async::TaskRunner::operator()(), Async::TaskRunner::operator()(), and Async::AudioThreadSource::~AudioThreadSource().

◆ clearTasks()

void Async::Application::clearTasks ( void )
protected

◆ exec()

virtual void Async::Application::exec ( void )
pure virtual

Execute the application main loop.

When this member function is called the application core will enter the core main loop. It will not exit from this loop until the Async::Application::quit method is called.

Implemented in Async::CppApplication, and Async::QtApplication.

◆ quit()

virtual void Async::Application::quit ( void )
pure virtual

Exit the application main loop.

This function should be called to exit the application core main loop.

Implemented in Async::CppApplication.

Examples
AsyncAudioContainer_demo.cpp.

◆ runTask()

void Async::Application::runTask ( sigc::slot< void > task)

Run a task from the Async main loop.

Parameters
taskThe task (SigC++ slot) to run

This function can be used to delay a function call until the call chain have returned to the Async main loop. This may be required in some cases where one otherwise would get into trouble with complex callback chains causing strange errors.

Use it something like this to call a function taking no arguments:

runTask(mem_fun(*this, &MyClass::func));

If the function need arguments passed to it, they must be bound to the slot using the sigc::bind function:

runTask(sigc::bind(mem_fun(*this, &MyClass::func), true, my_int));

In this case the function take two arguments where the first is a bool and the second is an integer.

Referenced by Async::TaskRunner::operator()(), and Async::TaskRunner::operator()().

Friends And Related Symbol Documentation

◆ DnsLookup

friend class DnsLookup
friend

Definition at line 187 of file AsyncApplication.h.

◆ FdWatch

friend class FdWatch
friend

Definition at line 185 of file AsyncApplication.h.

◆ Timer

friend class Timer
friend

Definition at line 186 of file AsyncApplication.h.


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