1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef META_INTERFACE_IMETA_OBJECT_LIB_H 17 #define META_INTERFACE_IMETA_OBJECT_LIB_H 18 19 #include <core/namespace.h> 20 #include <core/plugin/intf_interface.h> 21 22 #include <meta/base/interface_macros.h> 23 #include <meta/base/namespace.h> 24 25 CORE_BEGIN_NAMESPACE() 26 struct SyncApi; 27 CORE_END_NAMESPACE() 28 29 META_BEGIN_NAMESPACE() 30 31 class IObjectRegistry; 32 class ITaskQueueRegistry; 33 class IBindingState; 34 class IAnimationController; 35 36 /** 37 * @brief Meta object library global access point for globally used objects. 38 */ 39 class IMetaObjectLib : public CORE_NS::IInterface { 40 META_INTERFACE(CORE_NS::IInterface, IMetaObjectLib, "6f4ba852-3a00-4bbd-82bf-c36fb657992e") 41 public: 42 virtual IObjectRegistry& GetObjectRegistry() const = 0; 43 virtual ITaskQueueRegistry& GetTaskQueueRegistry() const = 0; 44 virtual BASE_NS::shared_ptr<IAnimationController> GetAnimationController() const = 0; 45 virtual const CORE_NS::SyncApi& GetSyncApi() const = 0; 46 }; 47 48 /** 49 * @brief Get global IMetaObjectLib instance. 50 */ GetMetaObjectLib()51inline IMetaObjectLib& GetMetaObjectLib() 52 { 53 auto* instance = CORE_NS::GetInstance<IMetaObjectLib>(IMetaObjectLib::UID); 54 if (instance) { 55 return *instance; 56 } 57 CORE_LOG_F("Meta Object Lib not initialized"); 58 CORE_ASSERT(false); 59 return *instance; 60 } 61 62 META_END_NAMESPACE() 63 64 #endif 65