Rendering optimisation with AddOn
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / dali-toolkit-test-utils / test-addon-manager.h
1 #ifndef TEST_ADDON_MANAGER_H
2 #define TEST_ADDON_MANAGER_H
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 #include <dali/public-api/common/vector-wrapper.h>
23 #include <string>
24
25 namespace Dali
26 {
27 namespace Test
28 {
29 class AddOnManager : public Dali::Integration::AddOnManager
30 {
31 public:
32
33   /**
34    * @brief Constructor, initialised by the Adaptor
35    */
36   AddOnManager() = default;
37
38   /**
39    * @brief Destructor
40    */
41   virtual ~AddOnManager() = default;
42
43   std::vector<std::string> EnumerateAddOns() override;
44
45   bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) override;
46
47   std::vector<AddOnLibrary> LoadAddOns( const std::vector<std::string>& addonNames ) override;
48
49   void* GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override;
50
51   void* GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override;
52
53   void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) override;
54
55   void Start() override;
56
57   void Resume() override;
58
59   void Stop() override;
60
61   void Pause() override;
62
63   struct AddOnCacheEntry
64   {
65     std::string name{};
66     AddOnInfo info{};
67
68     // library handle
69     void* handle {nullptr};
70
71     // main function pointers
72     void(*GetAddOnInfo)(AddOnInfo& ) = nullptr; ///< Returns AddOnInfo structure
73     void*(*GetInstanceProc)( const char* ) = nullptr; ///< Returns pointer of instance function (member funtion)
74     void*(*GetGlobalProc)( const char* ) = nullptr; ///< Returns pointer of global function (non-member function)
75
76     void(*OnStart)() = nullptr;
77     void(*OnResume)() = nullptr;
78     void(*OnPause)() = nullptr;
79     void(*OnStop)() = nullptr;
80
81     bool valid = false;
82   };
83
84   std::vector<AddOnCacheEntry> mAddOnCache;
85 };
86 } // Namespace Test
87 } // namespace Dali
88
89 #endif // TEST_ADDON_MANAGER_H