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_SRC_ENGINE_ENGINE_INPUT_PROPERTY_MANAGER_H
17 #define META_SRC_ENGINE_ENGINE_INPUT_PROPERTY_MANAGER_H
18
19 #include <meta/interface/engine/intf_engine_input_property_manager.h>
20
21 #include "engine_value_manager.h"
22
META_BEGIN_NAMESPACE()23 META_BEGIN_NAMESPACE()
24
25 namespace Internal {
26
27 class EngineInputPropertyManager : public IntroduceInterfaces<BaseObject, IEngineInputPropertyManager> {
28 META_OBJECT(EngineInputPropertyManager, META_NS::ClassId::EngineInputPropertyManager, IntroduceInterfaces)
29 public:
30 bool Build(const IMetadata::Ptr& data) override;
31
32 bool Sync() override;
33
34 IProperty::Ptr ConstructProperty(BASE_NS::string_view name) override;
35 IProperty::Ptr TieProperty(const IProperty::Ptr&, BASE_NS::string valueName) override;
36 BASE_NS::vector<IProperty::Ptr> GetAllProperties() const override;
37 bool PopulateProperties(IMetadata&) override;
38 void RemoveProperty(BASE_NS::string_view name) override;
39
40 IEngineValueManager::Ptr GetValueManager() const override;
41
42 private:
43 mutable std::shared_mutex mutex_;
44 struct PropInfo {
45 IProperty::Ptr property;
46 IEngineValue::Ptr value;
47 };
48 IEngineValueManager::Ptr manager_;
49 BASE_NS::unordered_map<BASE_NS::string, PropInfo> props_;
50 };
51
52 } // namespace Internal
53
54 META_END_NAMESPACE()
55
56 #endif