Modify tizen coding style
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / dotnet / dotnet_launcher.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef __DOTNET_LAUNCHER_H__
18 #define __DOTNET_LAUNCHER_H__
19
20 #include "launcher.h"
21
22 extern "C"
23 {
24         typedef int (*coreclr_initialize_ptr)(
25                         const char* exePath,
26                         const char* appDomainFriendlyName,
27                         int propertyCount,
28                         const char** propertyKeys,
29                         const char** propertyValues,
30                         void** hostHandle,
31                         unsigned int* domainId);
32
33         typedef int (*coreclr_execute_assembly_ptr)(
34                         void* hostHandle,
35                         unsigned int domainId,
36                         int argc,
37                         const char** argv,
38                         const char* managedAssemblyPath,
39                         unsigned int* exitCode);
40
41         typedef int (*coreclr_shutdown_ptr)(
42                         void* hostHandle,
43                         unsigned int domainId);
44
45         typedef int (*coreclr_create_delegate_ptr)(
46                         void* hostHandle,
47                         unsigned int domainId,
48                         const char* entryPointAssemblyName,
49                         const char* entryPointTypeName,
50                         const char* entryPointMethodName,
51                         void** delegate);
52 }
53
54 namespace tizen {
55 namespace runtime {
56 namespace dotnetcore {
57
58 typedef void (*PreparedFunctionPtr)();
59 typedef bool (*LaunchFunctionPtr)(const char* root, const char* path, int argc, char* argv[]);
60
61 class CoreRuntime : public tizen::runtime::LauncherInterface
62 {
63         public:
64                 CoreRuntime();
65                 ~CoreRuntime();
66                 int initialize(bool standalone) override;
67                 void dispose() override;
68                 int runManagedLauncher(const char* appId, const char* appBase, const char* tpaList) override;
69                 int launch(const char* appId, const char* root, const char* path, int argc, char* argv[]) override;
70
71         private:
72                 bool initializeCoreClr(const char* appId, const char* assemblyProbePaths, const char* pinvokeProbePaths, const char* tpaList);
73                 coreclr_initialize_ptr initializeClr;
74                 coreclr_execute_assembly_ptr executeAssembly;
75                 coreclr_shutdown_ptr shutdown;
76                 coreclr_create_delegate_ptr createDelegate;
77                 std::string __deviceAPIDirectory;
78                 std::string __runtimeDirectory;
79                 std::string __launcherAssembly;
80                 std::string __nativeLibDirectory;
81                 void* __coreclrLib;
82                 void* __hostHandle;
83                 unsigned int __domainId;
84                 PreparedFunctionPtr preparedFunction;
85                 LaunchFunctionPtr launchFunction;
86 };
87
88 }  // dotnetcore
89 }  // namespace runtime
90 }  // namespace tizen
91
92 #endif /* __DOTNET_LAUNCHER_H__ */