[dali_2.3.26] Merge branch 'devel/master'
[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) 2021 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 namespace Internal
26 {
27 class AddOnManager;
28 };
29
30 namespace Adaptor
31 {
32 class AddOnManager : public Dali::Integration::AddOnManager
33 {
34 public:
35   /**
36    * @brief Constructor
37    * @param impl Pointer to the platform specific implementation
38    */
39   explicit AddOnManager(Internal::AddOnManager* impl);
40
41   /**
42    * @brief Destructor
43    */
44   ~AddOnManager() override;
45
46   /**
47    * @brief Registers a dispatch table for new AddOn. Dispatch table contains essential
48    * functions that will be called by the AddOnManager. It also includes lifecycle
49    * event callbacks.
50    * @param[in] dispatchTable Valid pointer to the DispatchTable object
51    */
52   void RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable) override;
53
54   /**
55    * @brief Retrieves list of all the extensions available
56    * @return List of AddOn names
57    */
58   std::vector<std::string> EnumerateAddOns() override;
59
60   /**
61    * @brief Returns AddOnInfo structure for specified extension name
62    * @param[in] name Name of extension
63    * @param[out]] info Output reference
64    * @return True on success, False if extension info cannot be retrieved
65    */
66   bool GetAddOnInfo(const std::string& name, AddOnInfo& info) override;
67
68   /**
69    * @brief Loads and initialises specified extensions
70    *
71    * @param[in] extensionNames Array of extension names
72    * @return vector of initialised extension handles
73    */
74   std::vector<AddOnLibrary> LoadAddOns(const std::vector<std::string>& addonNames) override;
75
76   /**
77    * @brief Returns addon global function pointer
78    * @param[in] addonHandle Addon handle
79    * @param[in] procName Name of the function to retrieve
80    * @return Pointer to the function or null if function doesn't exist
81    */
82   void* GetGlobalProc(const Dali::AddOnLibrary& addonHandle, const char* procName) override;
83
84   /**
85    * @brief Returns addon instance function pointer
86    * @param[in] addonHandle Addon handle
87    * @param[in] procName Name of the function to retrieve
88    * @return Pointer to the function or null if function doesn't exist
89    */
90   void* GetInstanceProc(const Dali::AddOnLibrary& addonHandle, const char* procName) override;
91
92   /**
93    * @brief Lifecycle pause function
94    */
95   void Pause() override;
96
97   /**
98    * @brief Lifecycle resume function
99    */
100   void Resume() override;
101
102   /**
103    * @brief Lifecycle start function
104    */
105   void Start() override;
106
107   /**
108    * @brief Lifecycle stop function
109    */
110   void Stop() override;
111
112 private:
113   std::unique_ptr<Internal::AddOnManager> mImpl; /// Implementation of the AddOnManager
114 };
115 } // namespace Adaptor
116 } // namespace Dali
117
118 #endif // DALI_ADAPTOR_COMMON_ADDON_MANAGER