1 #ifndef DALI_BASE_OBJECT_IMPL_H
2 #define DALI_BASE_OBJECT_IMPL_H
5 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali/integration-api/ordered-set.h>
30 * @brief Holds the Implementation for the BaseObject class
32 class BaseObject::Impl
36 * @brief Retrieves the implementation of the internal BaseObject class.
37 * @param[in] internalBaseObject A ref to the BaseObject whose internal implementation is required
38 * @return The internal implementation
40 static BaseObject::Impl& Get(BaseObject& baseObject);
43 * @copydoc Get( BaseObject& )
45 static const BaseObject::Impl& Get(const BaseObject& baseObject);
49 * @param[in] baseObject The base object which owns this implementation
51 Impl(BaseObject& baseObject);
62 * Called shortly before the object itself is destroyed; no further callbacks will be received.
63 * @param[in] object The base object.
65 virtual void ObjectDestroyed(BaseObject& object) = 0;
71 virtual ~Observer() = default;
75 * Add an observer to the object.
76 * @param[in] observer The observer to add.
78 void AddObserver(Observer& observer);
81 * Remove an observer from the object
82 * @pre The observer has already been added.
83 * @param[in] observer The observer to remove.
85 void RemoveObserver(Observer& observer);
88 BaseObject& mBaseObject;
89 Dali::Integration::OrderedSet<Observer, false> mObservers; ///< All observing items (not owned).
91 bool mObserverNotifying : 1; ///< Whether we are currently notifying observers.
96 #endif // DALI_BASE_OBJECT_IMPL_H