Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
|
#include <Operation.h>
An abstraction for discrete units of work, or tasks.
Operations are typically executed via an OperationQueue.
Definition at line 50 of file Operation.h.
Properties | |
_Bool | asynchronous |
If true , this Operation will be expected to coordinate its own concurrency and internal state management by overriding start . More... | |
ident | data |
The user data. More... | |
OperationFunction | function |
The Operation function. More... | |
_Bool | isCancelled |
true when this Operation has been cancelled, false otherwise. More... | |
_Bool | isExecuting |
true when this Operation is executing, false otherwise. More... | |
_Bool | isFinished |
true when this Operation is finished, false otherwise. More... | |
Object | object |
The superclass. More... | |
Condition * | condition |
The Condition enabling waitUntilFinished . More... | |
MutableArray * | dependencies |
Contains Operations which must finish before this one can start. More... | |
![]() | |
Class * | clazz |
Every instance of Object begins with a pointer to its Class. More... | |
Methods | |
Class * | _Operation (void) |
The Operation archetype. More... | |
void | addDependency (Operation *self, Operation *dependency) |
Makes this Operation dependent on the completion of dependency . More... | |
void | cancel (Operation *self) |
Cancels this Operation, allowing it to complete immediately. More... | |
Array * | dependencies (const Operation *self) |
Operation * | init (Operation *self) |
Initializes this Operation. More... | |
Operation * | initWithFunction (Operation *self, OperationFunction function, ident data) |
Initializes a synchronous Operation with the given function . More... | |
_Bool | isReady (const Operation *self) |
void | removeDependency (Operation *self, Operation *dependency) |
Removes the dependency on dependency . More... | |
void | start (Operation *self) |
Starts this Operation. More... | |
void | waitUntilFinished (const Operation *self) |
Blocks the current thread until this Operation isFinished . More... | |
![]() | |
Class * | _Object (void) |
The Object archetype. More... | |
Object * | copy (const Object *self) |
Creates a shallow copy of this Object. More... | |
void | dealloc (Object *self) |
Frees all resources held by this Object. More... | |
String * | description (const Object *self) |
int | hash (const Object *self) |
Object * | init (Object *self) |
Initializes this Object. More... | |
_Bool | isEqual (const Object *self, const Object *other) |
Tests equality of the other Object. More... | |
_Bool | isKindOfClass (const Object *self, const Class *clazz) |
Tests for Class hierarchy membership. More... | |
Protected Attributes | |
OperationInterface * | interface |
The interface. More... | |
![]() | |
ObjectInterface * | interface |
The interface. More... | |
_Bool Operation::asynchronous |
If true
, this Operation will be expected to coordinate its own concurrency and internal state management by overriding start
.
Definition at line 84 of file Operation.h.
Condition* Operation::condition |
The Condition enabling waitUntilFinished
.
Definition at line 71 of file Operation.h.
ident Operation::data | ( | void | ) |
The user data.
Definition at line 89 of file Operation.h.
MutableArray* Operation::dependencies |
Contains Operations which must finish before this one can start.
Definition at line 76 of file Operation.h.
OperationFunction Operation::function |
The Operation function.
Definition at line 94 of file Operation.h.
|
protected |
The interface.
Definition at line 61 of file Operation.h.
_Bool Operation::isCancelled |
true
when this Operation has been cancelled, false
otherwise.
Definition at line 99 of file Operation.h.
_Bool Operation::isExecuting |
true
when this Operation is executing, false
otherwise.
Definition at line 104 of file Operation.h.
_Bool Operation::isFinished |
true
when this Operation is finished, false
otherwise.
Definition at line 109 of file Operation.h.
Object Operation::object |
The superclass.
Definition at line 55 of file Operation.h.
Class * _Operation | ( | void | ) |
The Operation archetype.
Definition at line 233 of file Operation.c.
Makes this Operation dependent on the completion of dependency
.
Definition at line 60 of file Operation.c.
void cancel | ( | Operation * | self | ) |
Cancels this Operation, allowing it to complete immediately.
self | The Operation. |
Definition at line 74 of file Operation.c.
self | The Operation. |
Definition at line 89 of file Operation.c.
Initializes this Operation.
self | The Operation. |
NULL
on error. Definition at line 100 of file Operation.c.
Operation * initWithFunction | ( | Operation * | self, |
OperationFunction | function, | ||
ident | data | ||
) |
Initializes a synchronous Operation with the given function
.
self | The Operation. |
function | The OperationFunction to perform |
data | The user data. |
NULL
on error. Definition at line 119 of file Operation.c.
_Bool isReady | ( | const Operation * | self | ) |
self | The Operation. |
true
when all criteria for this Operation to start
are met. Definition at line 134 of file Operation.c.
Removes the dependency on dependency
.
self | The Operation. |
dependency | The dependency. |
void start | ( | Operation * | self | ) |
Starts this Operation.
self | The Operation. |
function
synchronously. When this method returns, the Operation isFinished
and has removed itself from any queues it belonged to. super
. Definition at line 171 of file Operation.c.
void waitUntilFinished | ( | const Operation * | self | ) |
Blocks the current thread until this Operation isFinished
.
self | The Operation. |
Definition at line 199 of file Operation.c.