GoWebScan API
 All Classes Files Functions Variables Typedefs Macros Modules Pages
GoWebScanPipeTask.h
Go to the documentation of this file.
1 /**
2 * @file GoWebScanPipeTask.h
3 * @brief Declares the GoWebScanPipeTask class
4 *
5 * @internal
6 * Copyright (C) 2017-2018 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 #ifndef GO_WEB_SCAN_PIPE_TASK_H
11 #define GO_WEB_SCAN_PIPE_TASK_H
12 
14 
15 kBeginHeader()
16 
17 /**
18 * @class GoWebScanPipeTask
19 * @extends kObject
20 * @ingroup GoWebScanSdk-Pipe
21 * @brief Represents a processing task for the GoWebScanPipe class.
22 * Each GoWebScanPipeTask maintains a FIFO queue of messages to process (jobs), and submits jobs to the GoWebScanPipe for execution.
23 * Each GoWebScanPipeTask has at most one pending job submitted to the Pipe for execution at any given time. Multiple jobs associated
24 * with a single task cannot be run in parallel (tasks are assumed to have non-thread-safe state). Each GoWebScanPipeTask
25 * is associated with a particular stage (processing priority); multiple tasks can belong to the same stage. Messages are processed
26 * through an execution handler provided to the GoWebScanPipeTask.
27 */
28 typedef kObject GoWebScanPipeTask;
29 
30 // Forward declartions
31 typedef kObject GoWebScanPipe;
33 
34 /** Defines the signature for the job execution handler. */
35 typedef kStatus(kCall *GoWebScanPipeTaskExecuteFx)(GoWebScanPipeTask task, GoWebScanPipeMsg msg);
36 
37 /**
38 * Sets the callback function that is used to execute processing jobs
39 *
40 * @public @memberof GoWebScanPipeTask
41 * @param task GoWebScanPipeTask object.
42 * @param function Processing execution callback function
43 * @param receiver Receiver argument for callback.
44 * @return Operation status.
45 */
46 GoWebScanFx(kStatus) GoWebScanPipeTask_SetExecuteHandler(GoWebScanPipeTask task, GoWebScanPipeTaskExecuteFx function, kPointer receiver);
47 
48 /**
49 * Gets the stage (processing priority) of a task
50 *
51 * @public @memberof GoWebScanPipeTask
52 * @param task GoWebScanPipeTask object.
53 * @return Stage.
54 */
55 GoWebScanFx(k32u) GoWebScanPipeTask_Stage(GoWebScanPipeTask task);
56 
57 /**
58 * Sets the stage (processing priority) of a task
59 *
60 * @public @memberof GoWebScanPipeTask
61 * @param task GoWebScanPipeTask object.
62 * @param stage Stage.
63 * @return Operation status.
64 */
65 GoWebScanFx(kStatus) GoWebScanPipeTask_SetStage(GoWebScanPipeTask task, k32u stage);
66 
67 /**
68 * Adds a message to the processing queue. Dequeues a message at the end of the queue to submit to the pipe
69 * for scheduling if no other job is currently pending.
70 *
71 * @public @memberof GoWebScanPipeTask
72 * @param task GoWebScanPipeTask object.
73 * @param message Message to enqueue.
74 * @return Operation status.
75 */
76 GoWebScanFx(kStatus) GoWebScanPipeTask_Send(GoWebScanPipeTask task, GoWebScanPipeMsg message);
77 
78 /**
79 * Gets the maximum capacity of the message queue
80 *
81 * @public @memberof GoWebScanPipeTask
82 * @param task GoWebScanPipeTask object.
83 * @return Maximum queue capacity.
84 */
85 GoWebScanFx(kSize) GoWebScanPipeTask_MsgCapacity(GoWebScanPipeTask task);
86 
87 /**
88 * Sets the maximum capacity of the message queue
89 *
90 * @public @memberof GoWebScanPipeTask
91 * @param task GoWebScanPipeTask object.
92 * @param capacity Maximum queue capacity.
93 * @return Operation status.
94 */
95 GoWebScanFx(kStatus) GoWebScanPipeTask_SetMsgCapacity(GoWebScanPipeTask task, kSize capacity);
96 
97 
98 kEndHeader()
99 #include <GoWebScanSdk/GoWebScanPipeTask.x.h>
100 
101 #endif
102 
kStatus GoWebScanPipeTask_SetMsgCapacity(GoWebScanPipeTask task, kSize capacity)
Sets the maximum capacity of the message queue.
kStatus GoWebScanPipeTask_SetStage(GoWebScanPipeTask task, k32u stage)
Sets the stage (processing priority) of a task.
Essential GoWebScan declarations.
kStatus GoWebScanPipeTask_Send(GoWebScanPipeTask task, GoWebScanPipeMsg message)
Adds a message to the processing queue.
kStatus(kCall * GoWebScanPipeTaskExecuteFx)(GoWebScanPipeTask task, GoWebScanPipeMsg msg)
Defines the signature for the job execution handler.
Definition: GoWebScanPipeTask.h:35
Represents a processing task for the GoWebScanPipe class. Each GoWebScanPipeTask maintains a FIFO que...
k32u GoWebScanPipeTask_Stage(GoWebScanPipeTask task)
Gets the stage (processing priority) of a task.
kStatus GoWebScanPipeTask_SetExecuteHandler(GoWebScanPipeTask task, GoWebScanPipeTaskExecuteFx function, kPointer receiver)
Sets the callback function that is used to execute processing jobs.
kSize GoWebScanPipeTask_MsgCapacity(GoWebScanPipeTask task)
Gets the maximum capacity of the message queue.
Represents a pipeline to run sequences of processing tasks concurrently. A GoWebScanPipe object coord...
Base class for a msg that can be processed with a GoWebScanPipeTask and submitted to the GoWebScanPip...