CountAsyncTask Struct Reference

A datatype for an AsyncTask that has a counter that sends a signal when that counter reaches a given limit. More...

#include <count_async_task.h>

Collaboration diagram for CountAsyncTask:
[legend]

Public Member Functions

CountAsyncTaskAllocateCountAsyncTask (const char *name_s, struct AsyncTasksManager *manager_p, bool add_flag, int32 limit)
 Allocate a CountAsyncTask. More...
 
bool InitCountAsyncTask (CountAsyncTask *count_task_p, const char *name_s, struct AsyncTasksManager *manager_p, bool add_flag, int32 limit)
 Initialise a CountAsyncTask. More...
 
AsyncTaskGetAsyncTaskFromCountAsyncTask (CountAsyncTask *count_task_p)
 Get the underlying AsyncTask for a given CountAsyncTask. More...
 
void FreeCountAsyncTask (CountAsyncTask *count_task_p)
 Free a CountAsyncTask. More...
 
void ClearCountAsyncTask (CountAsyncTask *count_task_p)
 Remove and free the underlying AsyncTask from a given CountAsyncTask. More...
 
bool IncrementCountAsyncTask (CountAsyncTask *count_task_p)
 Increment the counter for a given CountAsyncTask. More...
 
bool ContinueCountAsyncTask (const CountAsyncTask *count_task_p)
 The default callback function to check whether a CountAsyncTask could continue running. More...
 
void SetCountAsyncTaskLimit (CountAsyncTask *task_p, int32 limit)
 Set the limit for a given CountAsyncTask. More...
 

Data Fields

AsyncTaskcat_task_p
 The underlying AsyncTask. More...
 
int32 cat_current_value
 The current value of the counter for this CountAsyncTask. More...
 
int32 cat_limit
 The value at which this CountAsyncTask will send the message saying that it has completed. More...
 

Detailed Description

A datatype for an AsyncTask that has a counter that sends a signal when that counter reaches a given limit.

This is used when you are running a set number of jobs and you are waiting for a certain number of them to complete.

Member Function Documentation

◆ AllocateCountAsyncTask()

CountAsyncTask * AllocateCountAsyncTask ( const char *  name_s,
struct AsyncTasksManager manager_p,
bool  add_flag,
int32  limit 
)

Allocate a CountAsyncTask.

Parameters
name_sThe name to give to this CountAsyncTask. This value will be deep-copied.
manager_pThe AsyncTasksManager that will own this AsyncTask.
add_flagIf this is true then the newly-allocated CountAsyncTask will be added to the given AsyncTasksManager's list of AsyncTasks, false otherwise.
limitThe limit at which this CountAsyncTask will signal its completion.
Returns
The newly-allocated CountAsyncTask or NULL upon error.

◆ InitCountAsyncTask()

bool InitCountAsyncTask ( CountAsyncTask count_task_p,
const char *  name_s,
struct AsyncTasksManager manager_p,
bool  add_flag,
int32  limit 
)

Initialise a CountAsyncTask.

Parameters
count_task_pThe CountAsyncTask to initialise.
name_sThe name to give to this CountAsyncTask. This value will be deep-copied.
manager_pThe AsyncTasksManager that will own this AsyncTask.
add_flagIf this is true then the newly-allocated CountAsyncTask will be added to the given AsyncTasksManager's list of AsyncTasks, false otherwise.
limitThe limit at which this CountAsyncTask will signal its completion.
Returns
true if the CountAsyncTask was initialised successfully, false otherwise.

◆ GetAsyncTaskFromCountAsyncTask()

AsyncTask * GetAsyncTaskFromCountAsyncTask ( CountAsyncTask count_task_p)

Get the underlying AsyncTask for a given CountAsyncTask.

Parameters
count_task_pThe CountAsyncTask to get the AsyncTask for.
Returns
The AsyncTask.

◆ FreeCountAsyncTask()

void FreeCountAsyncTask ( CountAsyncTask count_task_p)

Free a CountAsyncTask.

Parameters
count_task_pThe CountAsyncTask to free.

◆ ClearCountAsyncTask()

void ClearCountAsyncTask ( CountAsyncTask count_task_p)

Remove and free the underlying AsyncTask from a given CountAsyncTask.

Parameters
count_task_pThe CountAsyncTask to alter.

◆ IncrementCountAsyncTask()

bool IncrementCountAsyncTask ( CountAsyncTask count_task_p)

Increment the counter for a given CountAsyncTask.

If the CountAsyncTask reaches its limit, it will call SendSyncData for its underlying AsyncTask to notify any EventConsumers that it has completed

Parameters
count_task_pThe CountAsyncTask to increment.
Returns
true if the CountAsyncTask was incremented successfully, false otherwise.

◆ ContinueCountAsyncTask()

bool ContinueCountAsyncTask ( const CountAsyncTask count_task_p)

The default callback function to check whether a CountAsyncTask could continue running.

Parameters
count_task_pThe CountAsyncTask to check.
Returns
true if the CountAsyncTask's counter has reached the CountAsyncTask's limit, false otherwise.

◆ SetCountAsyncTaskLimit()

void SetCountAsyncTaskLimit ( CountAsyncTask task_p,
int32  limit 
)

Set the limit for a given CountAsyncTask.

Parameters
task_pThe CountAsyncTask to set the limit for.
limitThe new limit.

Field Documentation

◆ cat_task_p

AsyncTask* cat_task_p

The underlying AsyncTask.

◆ cat_current_value

int32 cat_current_value

The current value of the counter for this CountAsyncTask.

◆ cat_limit

int32 cat_limit

The value at which this CountAsyncTask will send the message saying that it has completed.


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