AddOn manager
[platform/core/uifw/dali-adaptor.git] / dali / internal / addons / common / addon-manager-impl.h
1 #ifndef DALI_INTERNAL_ADDON_MANAGER_IMPL
2 #define DALI_INTERNAL_ADDON_MANAGER_IMPL
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 #include <string>
24 #include <vector>
25 #include <memory>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 /**
32  * Base class for platform-specific implementation of AddOnManager
33  */
34 class AddOnManager
35 {
36 protected:
37
38   /**
39    * @brief Constructor
40    */
41   AddOnManager() = default;
42
43 public:
44   /**
45    * @brief Destructor
46    */
47   virtual ~AddOnManager() = default;
48
49   /**
50    * @brief Registers the dispatch table with AddOnManager.
51    * @param[in] dispatchTable Pointer to the valid dispatch table
52    */
53   virtual void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) = 0;
54
55   /**
56    * @brief Retrieves list of the available AddOns
57    * @return List of AddOn names
58    */
59   virtual std::vector<std::string> EnumerateAddOns() = 0;
60
61   /**
62    * @brief Returns AddOnInfo structure for specified AddOn name
63    * @param[in] name Name of AddOn
64    * @param[out]] info Output reference
65    * @return True on success, False if extension info cannot be retrieved
66    */
67   virtual bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) = 0;
68
69   /**
70    * @brief Loads and initialises specified AddOns
71    * @param[in] extensionNames Array of extension names
72    * @return vector of initialised AddOnLibrary handles
73    */
74   virtual std::vector<Dali::AddOnLibrary> LoadAddOns( const std::vector<std::string>& addonNames ) = 0;
75
76   /**
77    * @brief Returns AddOn global function pointer
78    * @param[in] addOnLibrary valid AddOn library object
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   virtual void* GetGlobalProc( const Dali::AddOnLibrary& addonHandle, const char* procName ) = 0;
83
84   /**
85    * @brief Returns addon instance function pointer
86    * @param[in] addOnLibrary valid AddOn library object
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   virtual void* GetInstanceProc( const Dali::AddOnLibrary& addonHandle, const char* procName ) = 0;
91
92   /**
93    * @brief Pause lifecycle event
94    * Implementation is optional and depends whether AddOn needs to handle lifecycle event.
95    */
96   virtual void Pause() {}
97
98   /**
99    * @brief Resume lifecycle event
100    * Implementation is optional and depends whether AddOn needs to handle lifecycle event.
101    */
102   virtual void Resume() {}
103
104   /**
105    * @brief Start lifecycle event
106    * Implementation is optional and depends whether AddOn needs to handle lifecycle event.
107    */
108   virtual void Start() {}
109
110   /**
111    * @brief Stop lifecycle event
112    * Implementation is optional and depends whether AddOn needs to handle lifecycle event.
113    */
114   virtual void Stop() {}
115 };
116
117 } // Internal
118
119 } // Dali
120
121 #endif // DALI_CMAKE_EXTENSION_MANAGER_IMPL