InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TaskInfo Class Reference

#include <TaskInfo.h>

Inheritance diagram for TaskInfo:

Public Types

typedef AsyncWorkPacketID TaskID
 

Public Member Functions

 TaskInfo (const IDTaskPtr &myTask)
 
 TaskInfo (IDTask &myTask)
 
 TaskInfo ()
 
 ~TaskInfo ()
 
 TaskInfo (const TaskInfo &other)
 
 TaskInfo (adobe::move_from< TaskInfo > other)
 
TaskInfooperator= (TaskInfo other)
 
TaskID GetID () const
 
bool GetTaskStatusData (TaskStatusInfo::StatusData &data) const
 
bool GetTaskProgressData (TaskProgressInfo::ProgressData &data) const
 
const AsyncWorkPacketJobSpec & GetJobSpec () const
 
PMString GetName () const
 
TaskStatusInfo::TaskState GetCurrentState () const
 
void ClearAlertMessages ()
 
PMReal GetTaskCompletionPercentage () const
 
AlertMessageQueue GetAlertMessages () const
 
ErrorStateInfo GetTaskExitErrorStateInfo () const
 
bool WasCancelled () const
 
bool IsValid () const
 
void Cancel ()
 
TaskStatusInfo::TaskState WaitForTask ()
 

Friends

void swap (TaskInfo &left, TaskInfo &right)
 
bool operator== (TaskInfo const &left, TaskInfo const &right)
 

Detailed Description

This class is used to track the status and progress of background tasks. Each top level task registers with the TaskMonitor which will hold a pointer to that task info. A client can obtain a TaskInfo from the TaskMonitor, store it and poll it for status and progress information. Not all tasks have progress information but all should have a name and should support cancellation.

Constructor & Destructor Documentation

TaskInfo::TaskInfo (const IDTaskPtr & myTask)
explicit

Construct a TaskInfo from a const IDTaskPtr

TaskInfo::TaskInfo (IDTask & myTask)
explicit

Construct a TaskInfo from an IDTask reference

TaskInfo::TaskInfo ()

Default constructor - creates an invalid task

TaskInfo::~TaskInfo ()

Destructor

TaskInfo::TaskInfo (const TaskInfoother)

Copy constructor - add a reference to the IDTaskPtr in other

Parameters
[in]otherTaskInfo representing the task
TaskInfo::TaskInfo (adobe::move_from< TaskInfoother)

Move constructor - moves the content of other into this object, leaving other in destructible state

Parameters
[in]otherTaskInfo that will be invalid after this method

Member Function Documentation

void TaskInfo::Cancel ()

Signal the underlying task to cancel.

Warning
This method returns immediately, so callers that depend on the task being stopped should call WaitForTask.
void TaskInfo::ClearAlertMessages ()

for internal use only Clear the alert messages for the task.

AlertMessageQueue TaskInfo::GetAlertMessages () const

Retrieves any alerts or errors from the task

See Also
AlertMessageQueue
Returns
an AlertMessageQueue containing alerts or errors from the task
TaskStatusInfo::TaskState TaskInfo::GetCurrentState () const

Retrieves the current state of the task

See Also
TaskStatusInfo::TaskState
Returns
state of the task.
TaskID TaskInfo::GetID () const

Retrieves the unique task identifier for this task.

Returns
the unique identifier for this task. If this TaskInfo is invalid this method returns kInvalidAsyncWorkPacketID
const AsyncWorkPacketJobSpec& TaskInfo::GetJobSpec () const

Retrieves the job spec for this task

PMString TaskInfo::GetName () const

Retrieves the task description

Returns
the task description string.
PMReal TaskInfo::GetTaskCompletionPercentage () const

Retrieves the current task completion as a percentage

Returns
task completion percentage.
ErrorStateInfo TaskInfo::GetTaskExitErrorStateInfo () const

Retrieves the ErrorStateInfo at exit of the task.

See Also
ErrorStateInfo
Returns
error state info at the exit of the task.
bool TaskInfo::GetTaskProgressData (TaskProgressInfo::ProgressDatadata) const

Retrieves a snapshot of all progress data.

See Also
TaskProgressInfo::ProgressData
Parameters
[out]datacurrent data. Only filled when the return value is true.
Returns
[false] if this task doesn't have a progress bar associated with it (its duration is indeterminate) [true] if the task has progress information.
Warning
If the return value is [false] the data parameter is unchanged.
Note
a task may return false if called early on startup before the task creates a progress bar.
bool TaskInfo::GetTaskStatusData (TaskStatusInfo::StatusDatadata) const

Retrieves a copy of the current task status info. Useful when the caller needs all the data in one call, or will be making several status-related calls.

See Also
TaskStatusInfo::StatusData
Parameters
[out]datacurrent data. Only filled when the return value is true.
Returns
[false] if this TaskInfo is invalid. [true] if the underlying task exists.
Warning
If the return value is [false] the data parameter is unchanged.
bool TaskInfo::IsValid () const
inline

Check if this TaskInfo refers to a valid task

Returns
true if this TaskInfo refers to a valid task
TaskInfo& TaskInfo::operator= (TaskInfo other)

Move-compatible assignment operator.

Parameters
[in]otherTaskInfo that will be invalid after this method
TaskStatusInfo::TaskState TaskInfo::WaitForTask ()

Wait for the underlying task to finish executing and return the state.

Returns
TaskStatusInfo::TaskState of the underlying task at completion.
bool TaskInfo::WasCancelled () const

Check if the underlying task was previously signaled to cancel

Returns
true if the task was cancelled, false otherwise

Friends And Related Function Documentation

bool operator== (TaskInfo const & left,
TaskInfo const & right 
)
friend

Equality operator

void swap (TaskInfoleft,
TaskInforight 
)
friend

swap the contents of two TaskInfo objects