[dali_2.1.18] Merge branch 'devel/master'
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / src / event-thread-callback-wrap.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // EXTERNAL INCLUDES
19 #include <dali/devel-api/adaptor-framework/event-thread-callback.h>
20
21 // INTERNAL INCLUDES
22 #include "common.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef void (SWIGSTDCALL* SWIG_CallbackMakeCallback)(void);
29
30 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_EventThreadCallback(SWIG_CallbackMakeCallback callbackOnMakeCallback) {
31   void * jresult ;
32   void (*arg1)(void) = (void (*)(void)) 0 ;
33   Dali::EventThreadCallback *result = 0 ;
34   Dali::CallbackBase * callbackBase = 0 ;
35
36   arg1 = (void (*)(void))callbackOnMakeCallback;
37   callbackBase = (Dali::CallbackBase *)Dali::MakeCallback(arg1);
38
39   {
40     try {
41       result = (Dali::EventThreadCallback *)new Dali::EventThreadCallback(callbackBase);
42     } catch (std::out_of_range& e) {
43       {
44         delete result;
45         delete callbackBase;
46         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
47       };
48     } catch (std::exception& e) {
49       {
50         delete result;
51         delete callbackBase;
52         SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
53       };
54     } catch (Dali::DaliException e) {
55       {
56         delete result;
57         delete callbackBase;
58         SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
59       };
60     } catch (...) {
61       {
62         delete result;
63         delete callbackBase;
64         SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
65       };
66     }
67   }
68   jresult = (void *)result;
69   return jresult;
70 }
71
72 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_EventThreadCallback(void * jarg1) {
73   Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
74
75   arg1 = (Dali::EventThreadCallback *)jarg1;
76   {
77     try {
78       delete arg1;
79     } CALL_CATCH_EXCEPTION();
80   }
81
82 }
83
84
85 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_EventThreadCallback_Trigger(void * jarg1) {
86   Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
87
88   arg1 = (Dali::EventThreadCallback *)jarg1;
89   {
90     try {
91       (arg1)->Trigger();
92     } CALL_CATCH_EXCEPTION();
93   }
94
95 }
96
97 #ifdef __cplusplus
98 }
99 #endif //CSHARP_EVENT_THREAD_CALLBACK
100