• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ENGINE_INTERFACE_ENGINE_INPUT_PROPERTY_MANAGER_H
17 #define META_ENGINE_INTERFACE_ENGINE_INPUT_PROPERTY_MANAGER_H
18 
19 #include <meta/interface/engine/intf_engine_value_manager.h>
20 #include <meta/interface/property/property.h>
21 
22 META_BEGIN_NAMESPACE()
23 
24 META_REGISTER_INTERFACE(IEngineInputPropertyManager, "db3adbf0-4caf-4b7b-8850-ee1f0936beab")
25 
26 /**
27  * @brief Collection of properties that are input for core engine
28  */
29 class IEngineInputPropertyManager : public CORE_NS::IInterface {
30     META_INTERFACE(CORE_NS::IInterface, IEngineInputPropertyManager)
31 public:
32     /**
33      * @brief Synchronise engine values to the core engine
34      * @return True if synchronising all properties worked, otherwise false
35      */
36     virtual bool Sync() = 0;
37     /**
38      * @brief Construct (or return existing) property with the corresponding type from core engine
39      *        and set the value from engine property as default value.
40      */
41     virtual IProperty::Ptr ConstructProperty(BASE_NS::string_view name) = 0;
42     /**
43      * @brief Ties the given property to engine value with 'valueName'
44      * @return The property given if successful, otherwise nullptr
45      */
46     virtual IProperty::Ptr TieProperty(const IProperty::Ptr&, BASE_NS::string valueName) = 0;
47     /**
48      * @brief Get all properties in this collection
49      */
50     virtual BASE_NS::vector<IProperty::Ptr> GetAllProperties() const = 0;
51     /**
52      * @brief Construct property for all associated engine values and add to the given IMetadata
53      * @return True on success
54      */
55     virtual bool PopulateProperties(IMetadata&) = 0;
56     /**
57      * @brief Remove property with given names
58      */
59     virtual void RemoveProperty(BASE_NS::string_view name) = 0;
60     /**
61      * @brief Get associated engine value manager
62      */
63     virtual IEngineValueManager::Ptr GetValueManager() const = 0;
64     /**
65      * @brief Construct (or return existing) property with the corresponding type from core engine
66      *        and set the value from engine property as default value.
67      */
68     template<typename Type>
ConstructProperty(BASE_NS::string_view name)69     Property<Type> ConstructProperty(BASE_NS::string_view name)
70     {
71         return Property<Type>(ConstructProperty(name));
72     }
73 };
74 
75 META_INTERFACE_TYPE(META_NS::IEngineInputPropertyManager)
76 META_END_NAMESPACE()
77 
78 #endif
79