e4d3da112862a8f8c0d36682402e41e00ff79fd2
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_task.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 /// <summary>EFL&apos;s abstraction for a task (process).
11 /// (Since EFL 1.22)</summary>
12 [Efl.Task.NativeMethods]
13 [Efl.Eo.BindingEntity]
14 public abstract class Task : Efl.LoopConsumer
15 {
16     ///<summary>Pointer to the native class description.</summary>
17     public override System.IntPtr NativeClass
18     {
19         get
20         {
21             if (((object)this).GetType() == typeof(Task))
22             {
23                 return GetEflClassStatic();
24             }
25             else
26             {
27                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
28             }
29         }
30     }
31
32     [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
33         efl_task_class_get();
34     /// <summary>Initializes a new instance of the <see cref="Task"/> class.</summary>
35     /// <param name="parent">Parent instance.</param>
36     public Task(Efl.Object parent= null
37             ) : base(efl_task_class_get(), parent)
38     {
39         FinishInstantiation();
40     }
41
42     /// <summary>Constructor to be used when objects are expected to be constructed from native code.</summary>
43     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
44     protected Task(ConstructingHandle ch) : base(ch)
45     {
46     }
47
48     /// <summary>Initializes a new instance of the <see cref="Task"/> class.
49     /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
50     /// <param name="wh">The native pointer to be wrapped.</param>
51     protected Task(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
52     {
53     }
54
55     [Efl.Eo.PrivateNativeClass]
56     private class TaskRealized : Task
57     {
58         private TaskRealized(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
59         {
60         }
61     }
62     /// <summary>Initializes a new instance of the <see cref="Task"/> class.
63     /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
64     /// <param name="baseKlass">The pointer to the base native Eo class.</param>
65     /// <param name="parent">The Efl.Object parent of this instance.</param>
66     protected Task(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
67     {
68     }
69
70     /// <summary>The priority of this task.
71     /// (Since EFL 1.22)</summary>
72     /// <returns>Desired priority.</returns>
73     virtual public Efl.TaskPriority GetPriority() {
74          var _ret_var = Efl.Task.NativeMethods.efl_task_priority_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
75         Eina.Error.RaiseIfUnhandledException();
76         return _ret_var;
77  }
78     /// <summary>The priority of this task.
79     /// (Since EFL 1.22)</summary>
80     /// <param name="priority">Desired priority.</param>
81     virtual public void SetPriority(Efl.TaskPriority priority) {
82                                  Efl.Task.NativeMethods.efl_task_priority_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),priority);
83         Eina.Error.RaiseIfUnhandledException();
84                          }
85     /// <summary>The final exit code of this task. This is the code that will be produced upon task completion.
86     /// (Since EFL 1.22)</summary>
87     /// <returns>The exit code.</returns>
88     virtual public int GetExitCode() {
89          var _ret_var = Efl.Task.NativeMethods.efl_task_exit_code_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
90         Eina.Error.RaiseIfUnhandledException();
91         return _ret_var;
92  }
93     /// <summary>Flags to further customize task&apos;s behavior.
94     /// (Since EFL 1.22)</summary>
95     /// <returns>Desired task flags.</returns>
96     virtual public Efl.TaskFlags GetFlags() {
97          var _ret_var = Efl.Task.NativeMethods.efl_task_flags_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
98         Eina.Error.RaiseIfUnhandledException();
99         return _ret_var;
100  }
101     /// <summary>Flags to further customize task&apos;s behavior.
102     /// (Since EFL 1.22)</summary>
103     /// <param name="flags">Desired task flags.</param>
104     virtual public void SetFlags(Efl.TaskFlags flags) {
105                                  Efl.Task.NativeMethods.efl_task_flags_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),flags);
106         Eina.Error.RaiseIfUnhandledException();
107                          }
108     /// <summary>Actually run the task.
109     /// (Since EFL 1.22)</summary>
110     /// <returns>A future triggered when task exits and is passed int exit code.</returns>
111     virtual public  Eina.Future Run() {
112          var _ret_var = Efl.Task.NativeMethods.efl_task_run_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
113         Eina.Error.RaiseIfUnhandledException();
114         return _ret_var;
115  }
116     /// <summary>Request the task end (may send a signal or interrupt signal resulting in a terminate event being tiggered in the target task loop).
117     /// (Since EFL 1.22)</summary>
118     virtual public void End() {
119          Efl.Task.NativeMethods.efl_task_end_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
120         Eina.Error.RaiseIfUnhandledException();
121          }
122     /// <summary>Async wrapper for <see cref="Run" />.</summary>
123     /// <param name="token">Token to notify the async operation of external request to cancel.</param>
124     /// <returns>An async task wrapping the result of the operation.</returns>
125     public System.Threading.Tasks.Task<Eina.Value> RunAsync( System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
126     {
127         Eina.Future future = Run();
128         return Efl.Eo.Globals.WrapAsync(future, token);
129     }
130
131     /// <summary>The priority of this task.
132     /// (Since EFL 1.22)</summary>
133     /// <value>Desired priority.</value>
134     public Efl.TaskPriority Priority {
135         get { return GetPriority(); }
136         set { SetPriority(value); }
137     }
138     /// <summary>The final exit code of this task. This is the code that will be produced upon task completion.
139     /// (Since EFL 1.22)</summary>
140     /// <value>The exit code.</value>
141     public int ExitCode {
142         get { return GetExitCode(); }
143     }
144     /// <summary>Flags to further customize task&apos;s behavior.
145     /// (Since EFL 1.22)</summary>
146     /// <value>Desired task flags.</value>
147     public Efl.TaskFlags Flags {
148         get { return GetFlags(); }
149         set { SetFlags(value); }
150     }
151     private static IntPtr GetEflClassStatic()
152     {
153         return Efl.Task.efl_task_class_get();
154     }
155     /// <summary>Wrapper for native methods and virtual method delegates.
156     /// For internal use by generated code only.</summary>
157     public new class NativeMethods : Efl.LoopConsumer.NativeMethods
158     {
159         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Ecore);
160         /// <summary>Gets the list of Eo operations to override.</summary>
161         /// <returns>The list of Eo operations to be overload.</returns>
162         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
163         {
164             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
165             var methods = Efl.Eo.Globals.GetUserMethods(type);
166
167             if (efl_task_priority_get_static_delegate == null)
168             {
169                 efl_task_priority_get_static_delegate = new efl_task_priority_get_delegate(priority_get);
170             }
171
172             if (methods.FirstOrDefault(m => m.Name == "GetPriority") != null)
173             {
174                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_priority_get"), func = Marshal.GetFunctionPointerForDelegate(efl_task_priority_get_static_delegate) });
175             }
176
177             if (efl_task_priority_set_static_delegate == null)
178             {
179                 efl_task_priority_set_static_delegate = new efl_task_priority_set_delegate(priority_set);
180             }
181
182             if (methods.FirstOrDefault(m => m.Name == "SetPriority") != null)
183             {
184                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_priority_set"), func = Marshal.GetFunctionPointerForDelegate(efl_task_priority_set_static_delegate) });
185             }
186
187             if (efl_task_exit_code_get_static_delegate == null)
188             {
189                 efl_task_exit_code_get_static_delegate = new efl_task_exit_code_get_delegate(exit_code_get);
190             }
191
192             if (methods.FirstOrDefault(m => m.Name == "GetExitCode") != null)
193             {
194                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_exit_code_get"), func = Marshal.GetFunctionPointerForDelegate(efl_task_exit_code_get_static_delegate) });
195             }
196
197             if (efl_task_flags_get_static_delegate == null)
198             {
199                 efl_task_flags_get_static_delegate = new efl_task_flags_get_delegate(flags_get);
200             }
201
202             if (methods.FirstOrDefault(m => m.Name == "GetFlags") != null)
203             {
204                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_flags_get"), func = Marshal.GetFunctionPointerForDelegate(efl_task_flags_get_static_delegate) });
205             }
206
207             if (efl_task_flags_set_static_delegate == null)
208             {
209                 efl_task_flags_set_static_delegate = new efl_task_flags_set_delegate(flags_set);
210             }
211
212             if (methods.FirstOrDefault(m => m.Name == "SetFlags") != null)
213             {
214                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_flags_set"), func = Marshal.GetFunctionPointerForDelegate(efl_task_flags_set_static_delegate) });
215             }
216
217             if (efl_task_run_static_delegate == null)
218             {
219                 efl_task_run_static_delegate = new efl_task_run_delegate(run);
220             }
221
222             if (methods.FirstOrDefault(m => m.Name == "Run") != null)
223             {
224                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_run"), func = Marshal.GetFunctionPointerForDelegate(efl_task_run_static_delegate) });
225             }
226
227             if (efl_task_end_static_delegate == null)
228             {
229                 efl_task_end_static_delegate = new efl_task_end_delegate(end);
230             }
231
232             if (methods.FirstOrDefault(m => m.Name == "End") != null)
233             {
234                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_task_end"), func = Marshal.GetFunctionPointerForDelegate(efl_task_end_static_delegate) });
235             }
236
237             descs.AddRange(base.GetEoOps(type));
238             return descs;
239         }
240         /// <summary>Returns the Eo class for the native methods of this class.</summary>
241         /// <returns>The native class pointer.</returns>
242         public override IntPtr GetEflClass()
243         {
244             return Efl.Task.efl_task_class_get();
245         }
246
247         #pragma warning disable CA1707, CS1591, SA1300, SA1600
248
249         
250         private delegate Efl.TaskPriority efl_task_priority_get_delegate(System.IntPtr obj, System.IntPtr pd);
251
252         
253         public delegate Efl.TaskPriority efl_task_priority_get_api_delegate(System.IntPtr obj);
254
255         public static Efl.Eo.FunctionWrapper<efl_task_priority_get_api_delegate> efl_task_priority_get_ptr = new Efl.Eo.FunctionWrapper<efl_task_priority_get_api_delegate>(Module, "efl_task_priority_get");
256
257         private static Efl.TaskPriority priority_get(System.IntPtr obj, System.IntPtr pd)
258         {
259             Eina.Log.Debug("function efl_task_priority_get was called");
260             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
261             if (ws != null)
262             {
263             Efl.TaskPriority _ret_var = default(Efl.TaskPriority);
264                 try
265                 {
266                     _ret_var = ((Task)ws.Target).GetPriority();
267                 }
268                 catch (Exception e)
269                 {
270                     Eina.Log.Warning($"Callback error: {e.ToString()}");
271                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
272                 }
273
274         return _ret_var;
275
276             }
277             else
278             {
279                 return efl_task_priority_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
280             }
281         }
282
283         private static efl_task_priority_get_delegate efl_task_priority_get_static_delegate;
284
285         
286         private delegate void efl_task_priority_set_delegate(System.IntPtr obj, System.IntPtr pd,  Efl.TaskPriority priority);
287
288         
289         public delegate void efl_task_priority_set_api_delegate(System.IntPtr obj,  Efl.TaskPriority priority);
290
291         public static Efl.Eo.FunctionWrapper<efl_task_priority_set_api_delegate> efl_task_priority_set_ptr = new Efl.Eo.FunctionWrapper<efl_task_priority_set_api_delegate>(Module, "efl_task_priority_set");
292
293         private static void priority_set(System.IntPtr obj, System.IntPtr pd, Efl.TaskPriority priority)
294         {
295             Eina.Log.Debug("function efl_task_priority_set was called");
296             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
297             if (ws != null)
298             {
299                                     
300                 try
301                 {
302                     ((Task)ws.Target).SetPriority(priority);
303                 }
304                 catch (Exception e)
305                 {
306                     Eina.Log.Warning($"Callback error: {e.ToString()}");
307                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
308                 }
309
310                         
311             }
312             else
313             {
314                 efl_task_priority_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), priority);
315             }
316         }
317
318         private static efl_task_priority_set_delegate efl_task_priority_set_static_delegate;
319
320         
321         private delegate int efl_task_exit_code_get_delegate(System.IntPtr obj, System.IntPtr pd);
322
323         
324         public delegate int efl_task_exit_code_get_api_delegate(System.IntPtr obj);
325
326         public static Efl.Eo.FunctionWrapper<efl_task_exit_code_get_api_delegate> efl_task_exit_code_get_ptr = new Efl.Eo.FunctionWrapper<efl_task_exit_code_get_api_delegate>(Module, "efl_task_exit_code_get");
327
328         private static int exit_code_get(System.IntPtr obj, System.IntPtr pd)
329         {
330             Eina.Log.Debug("function efl_task_exit_code_get was called");
331             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
332             if (ws != null)
333             {
334             int _ret_var = default(int);
335                 try
336                 {
337                     _ret_var = ((Task)ws.Target).GetExitCode();
338                 }
339                 catch (Exception e)
340                 {
341                     Eina.Log.Warning($"Callback error: {e.ToString()}");
342                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
343                 }
344
345         return _ret_var;
346
347             }
348             else
349             {
350                 return efl_task_exit_code_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
351             }
352         }
353
354         private static efl_task_exit_code_get_delegate efl_task_exit_code_get_static_delegate;
355
356         
357         private delegate Efl.TaskFlags efl_task_flags_get_delegate(System.IntPtr obj, System.IntPtr pd);
358
359         
360         public delegate Efl.TaskFlags efl_task_flags_get_api_delegate(System.IntPtr obj);
361
362         public static Efl.Eo.FunctionWrapper<efl_task_flags_get_api_delegate> efl_task_flags_get_ptr = new Efl.Eo.FunctionWrapper<efl_task_flags_get_api_delegate>(Module, "efl_task_flags_get");
363
364         private static Efl.TaskFlags flags_get(System.IntPtr obj, System.IntPtr pd)
365         {
366             Eina.Log.Debug("function efl_task_flags_get was called");
367             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
368             if (ws != null)
369             {
370             Efl.TaskFlags _ret_var = default(Efl.TaskFlags);
371                 try
372                 {
373                     _ret_var = ((Task)ws.Target).GetFlags();
374                 }
375                 catch (Exception e)
376                 {
377                     Eina.Log.Warning($"Callback error: {e.ToString()}");
378                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
379                 }
380
381         return _ret_var;
382
383             }
384             else
385             {
386                 return efl_task_flags_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
387             }
388         }
389
390         private static efl_task_flags_get_delegate efl_task_flags_get_static_delegate;
391
392         
393         private delegate void efl_task_flags_set_delegate(System.IntPtr obj, System.IntPtr pd,  Efl.TaskFlags flags);
394
395         
396         public delegate void efl_task_flags_set_api_delegate(System.IntPtr obj,  Efl.TaskFlags flags);
397
398         public static Efl.Eo.FunctionWrapper<efl_task_flags_set_api_delegate> efl_task_flags_set_ptr = new Efl.Eo.FunctionWrapper<efl_task_flags_set_api_delegate>(Module, "efl_task_flags_set");
399
400         private static void flags_set(System.IntPtr obj, System.IntPtr pd, Efl.TaskFlags flags)
401         {
402             Eina.Log.Debug("function efl_task_flags_set was called");
403             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
404             if (ws != null)
405             {
406                                     
407                 try
408                 {
409                     ((Task)ws.Target).SetFlags(flags);
410                 }
411                 catch (Exception e)
412                 {
413                     Eina.Log.Warning($"Callback error: {e.ToString()}");
414                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
415                 }
416
417                         
418             }
419             else
420             {
421                 efl_task_flags_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), flags);
422             }
423         }
424
425         private static efl_task_flags_set_delegate efl_task_flags_set_static_delegate;
426
427         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
428         private delegate  Eina.Future efl_task_run_delegate(System.IntPtr obj, System.IntPtr pd);
429
430         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
431         public delegate  Eina.Future efl_task_run_api_delegate(System.IntPtr obj);
432
433         public static Efl.Eo.FunctionWrapper<efl_task_run_api_delegate> efl_task_run_ptr = new Efl.Eo.FunctionWrapper<efl_task_run_api_delegate>(Module, "efl_task_run");
434
435         private static  Eina.Future run(System.IntPtr obj, System.IntPtr pd)
436         {
437             Eina.Log.Debug("function efl_task_run was called");
438             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
439             if (ws != null)
440             {
441              Eina.Future _ret_var = default( Eina.Future);
442                 try
443                 {
444                     _ret_var = ((Task)ws.Target).Run();
445                 }
446                 catch (Exception e)
447                 {
448                     Eina.Log.Warning($"Callback error: {e.ToString()}");
449                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
450                 }
451
452         return _ret_var;
453
454             }
455             else
456             {
457                 return efl_task_run_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
458             }
459         }
460
461         private static efl_task_run_delegate efl_task_run_static_delegate;
462
463         
464         private delegate void efl_task_end_delegate(System.IntPtr obj, System.IntPtr pd);
465
466         
467         public delegate void efl_task_end_api_delegate(System.IntPtr obj);
468
469         public static Efl.Eo.FunctionWrapper<efl_task_end_api_delegate> efl_task_end_ptr = new Efl.Eo.FunctionWrapper<efl_task_end_api_delegate>(Module, "efl_task_end");
470
471         private static void end(System.IntPtr obj, System.IntPtr pd)
472         {
473             Eina.Log.Debug("function efl_task_end was called");
474             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
475             if (ws != null)
476             {
477             
478                 try
479                 {
480                     ((Task)ws.Target).End();
481                 }
482                 catch (Exception e)
483                 {
484                     Eina.Log.Warning($"Callback error: {e.ToString()}");
485                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
486                 }
487
488         
489             }
490             else
491             {
492                 efl_task_end_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
493             }
494         }
495
496         private static efl_task_end_delegate efl_task_end_static_delegate;
497
498         #pragma warning restore CA1707, CS1591, SA1300, SA1600
499
500 }
501 }
502 }
503
504 namespace Efl {
505
506 /// <summary>How much processor time will this task get compared to other tasks running on the same processor.
507 /// (Since EFL 1.22)</summary>
508 [Efl.Eo.BindingEntity]
509 public enum TaskPriority
510 {
511 /// <summary>Neither above nor below average priority. This is the default.</summary>
512 Normal = 0,
513 /// <summary>Far below average priority.</summary>
514 Background = 1,
515 /// <summary>Below average priority.</summary>
516 Low = 2,
517 /// <summary>Above average priority.</summary>
518 High = 3,
519 /// <summary>Far above average priority.</summary>
520 Ultra = 4,
521 }
522
523 }
524
525 namespace Efl {
526
527 /// <summary>Flags to further customize task&apos;s behavior.
528 /// (Since EFL 1.22)</summary>
529 [Efl.Eo.BindingEntity]
530 public enum TaskFlags
531 {
532 /// <summary>No special flags.</summary>
533 None = 0,
534 /// <summary>Task will require console input.</summary>
535 UseStdin = 1,
536 /// <summary>Task will require console output.</summary>
537 UseStdout = 2,
538 /// <summary>Task will not produce an exit code upon termination.</summary>
539 NoExitCodeError = 4,
540 }
541
542 }
543