AddOn manager
[platform/core/uifw/dali-adaptor.git] / dali / internal / addons / common / addon-manager.h
1 #ifndef DALI_ADAPTOR_COMMON_ADDON_MANAGER
2 #define DALI_ADAPTOR_COMMON_ADDON_MANAGER
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include <dali/integration-api/addon-manager.h>
22
23 namespace Dali
24 {
25
26 namespace Internal
27 {
28 class AddOnManager;
29 };
30
31 namespace Adaptor
32 {
33
34 class AddOnManager : public Dali::Integration::AddOnManager
35 {
36 public:
37
38   /**
39    * @brief Constructor
40    * @param impl Pointer to the platform specific implementation
41    */
42   explicit AddOnManager(Internal::AddOnManager* impl);
43
44   /**
45    * @brief Destructor
46    */
47   ~AddOnManager() override;
48
49   /**
50    * @brief Registers a dispatch table for new AddOn. Dispatch table contains essential
51    * functions that will be called by the AddOnManager. It also includes lifecycle
52    * event callbacks.
53    * @param[in] dispatchTable Valid pointer to the DispatchTable object
54    */
55   void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) override;
56
57   /**
58    * @brief Retrieves list of all the extensions available
59    * @return List of AddOn names
60    */
61   std::vector<std::string> EnumerateAddOns() override;
62
63   /**
64    * @brief Returns AddOnInfo structure for specified extension name
65    * @param[in] name Name of extension
66    * @param[out]] info Output reference
67    * @return True on success, False if extension info cannot be retrieved
68    */
69   bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) override;
70
71   /**
72    * @brief Loads and initialises specified extensions
73    *
74    * @param[in] extensionNames Array of extension names
75    * @return vector of initialised extension handles
76    */
77   std::vector<AddOnLibrary> LoadAddOns( const std::vector<std::string>& addonNames ) override;
78
79   /**
80    * @brief Returns addon global function pointer
81    * @param[in] addonHandle Addon handle
82    * @param[in] procName Name of the function to retrieve
83    * @return Pointer to the function or null if function doesn't exist
84    */
85   void* GetGlobalProc( const Dali::AddOnLibrary& addonHandle, const char* procName ) override;
86
87   /**
88    * @brief Returns addon instance function pointer
89    * @param[in] addonHandle Addon handle
90    * @param[in] procName Name of the function to retrieve
91    * @return Pointer to the function or null if function doesn't exist
92    */
93   void* GetInstanceProc( const Dali::AddOnLibrary& addonHandle, const char* procName ) override;
94
95   /**
96    * @brief Lifecycle pause function
97    */
98   void Pause() override;
99
100   /**
101    * @brief Lifecycle resume function
102    */
103   void Resume() override;
104
105   /**
106    * @brief Lifecycle start function
107    */
108   void Start() override;
109
110   /**
111    * @brief Lifecycle stop function
112    */
113   void Stop() override;
114
115 private:
116
117   std::unique_ptr<Internal::AddOnManager> mImpl; /// Implementation of the AddOnManager
118
119 };
120 } // namespace Internal
121 } // namespace Dali
122
123 #endif // DALI_ADAPTOR_COMMON_ADDON_MANAGER