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_IOBJECT_CONTEXT_H
17 #define META_INTERFACE_IOBJECT_CONTEXT_H
18
19 #include <meta/base/namespace.h>
20 #include <meta/interface/builtin_objects.h>
21 #include <meta/interface/interface_macros.h>
22 #include <meta/interface/property/intf_property.h>
23
24 META_BEGIN_NAMESPACE()
25
26 META_REGISTER_INTERFACE(IObjectContext, "1f8bbc62-3d3e-4193-b3bf-8a4f65e55625")
27 META_REGISTER_INTERFACE(IObjectContextProvider, "940331af-d8b7-4865-bb69-a15cba347218")
28
29 /**
30 * @brief The IObjectContext interface defines the base interface for
31 * and object-specific object context.
32 */
33 class IObjectContext : public CORE_NS::IInterface {
34 META_INTERFACE(CORE_NS::IInterface, IObjectContext)
35 public:
36 /**
37 * @brief Returns the ObjectRegistry instance which should be returned
38 * by this context.
39 */
40 virtual IObjectRegistry& GetObjectRegistry() = 0;
41 };
42
43 META_END_NAMESPACE()
44
45 META_INTERFACE_TYPE(META_NS::IObjectContext);
46
META_BEGIN_NAMESPACE()47 META_BEGIN_NAMESPACE()
48
49 /**
50 * @brief The IObjectContextProvider interface defines an interface which can
51 * be implemented by objects that have an object context.
52 */
53 class IObjectContextProvider : public CORE_NS::IInterface {
54 META_INTERFACE(CORE_NS::IInterface, IObjectContextProvider)
55 public:
56 /**
57 * @brief Returns the ObjectContext property.
58 */
59 META_PROPERTY(IObjectContext::Ptr, ObjectContext);
60 /**
61 * @brief Resets the object context to a default value,
62 * @note Usually the default value is the object context returned
63 * by META_NS::GetDefaultObjectContext
64 */
65 virtual void ResetObjectContext() = 0;
66 };
67
68 META_END_NAMESPACE()
69
70 #endif
71