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