Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PredicateAsyncProcessor.cs
1using System.Threading.Tasks;
3
5{
11 {
12 private readonly PredicateAsync<T> callback;
13
19 public PredicateAsyncProcessor(PredicateAsync<T> Callback)
20 {
21 this.callback = Callback;
22 }
23
27 public bool IsAsynchronous => true;
28
34 public bool Process(T Object) => this.callback(Object).Result;
35
41 public Task<bool> ProcessAsync(T Object) => this.callback(Object);
42
47 public bool Flush()
48 {
49 return true;
50 }
51
56 public Task<bool> FlushAsync()
57 {
58 return Task.FromResult(true);
59 }
60 }
61}
Processor that uses an asynchronous predicate callback to process objects.
Task< bool > FlushAsync()
Called at the end of processing, to allow for flushing of buffers, etc.
bool Flush()
Called at the end of processing, to allow for flushing of buffers, etc.
bool IsAsynchronous
If the processor operates asynchronously.
PredicateAsyncProcessor(PredicateAsync< T > Callback)
Processor that uses an asynchronous predicate callback to process objects.
Task< bool > ProcessAsync(T Object)
Processes an object asynchronously.
bool Process(T Object)
Processes an object synchronously.
Interface for processors of objects.
Definition: IProcessor.cs:9