1 /* 2 * Copyright (C) 2023 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 CORE_ENGINE_FACTORY_H 17 #define CORE_ENGINE_FACTORY_H 18 19 #include <cstdint> 20 21 #include <base/containers/refcnt_ptr.h> 22 #include <base/containers/string_view.h> 23 #include <core/intf_engine.h> 24 #include <core/namespace.h> 25 #include <core/plugin/intf_class_info.h> 26 #include <core/plugin/intf_interface.h> 27 CORE_BEGIN_NAMESPACE()28CORE_BEGIN_NAMESPACE() 29 class EngineFactory final : public IEngineFactory, public IClassInfo { 30 public: 31 EngineFactory() = default; 32 ~EngineFactory() override = default; 33 34 // IInterface 35 const IInterface* GetInterface(const BASE_NS::Uid& uid) const override; 36 IInterface* GetInterface(const BASE_NS::Uid& uid) override; 37 void Ref() override; 38 void Unref() override; 39 40 // IClassInfo 41 BASE_NS::Uid GetClassUid() const override; 42 BASE_NS::string_view GetClassName() const override; 43 44 // IEngineFactory 45 IEngine::Ptr Create(const EngineCreateInfo& engineCreateInfo) override; 46 uint32_t refcnt_ { 0 }; 47 }; 48 CORE_END_NAMESPACE() 49 50 #endif // CORE_ENGINE_FACTORY_H 51