[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / particle-system / particle-source-impl.h
1 #ifndef DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_SOURCE_H
2 #define DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_SOURCE_H
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include <dali-toolkit/public-api/particle-system/particle-source.h>
21 #include <dali/public-api/object/base-object.h>
22 #include <memory>
23
24 namespace Dali::Toolkit::ParticleSystem::Internal
25 {
26 class ParticleList;
27 class ParticleEmitter;
28 class ParticleSource : public Dali::BaseObject
29 {
30 public:
31   ~ParticleSource() override = default;
32
33   explicit ParticleSource(std::unique_ptr<ParticleSourceInterface>&& sourceUpdater);
34
35   void Update(ParticleSystem::ParticleList& list, uint32_t count);
36
37   [[nodiscard]] ParticleSourceInterface& GetUpdater() const;
38
39 private:
40   std::unique_ptr<ParticleSourceInterface> mUpdater;
41 };
42
43 } // namespace Dali::Toolkit::ParticleSystem::Internal
44
45 namespace Dali::Toolkit::ParticleSystem
46 {
47 inline Internal::ParticleSource& GetImplementation(ParticleSystem::ParticleSource& source)
48 {
49   DALI_ASSERT_ALWAYS(source && "ParticleSource handle is empty");
50
51   BaseObject& handle = source.GetBaseObject();
52
53   return static_cast<Internal::ParticleSource&>(handle);
54 }
55
56 inline const Internal::ParticleSource& GetImplementation(const ParticleSystem::ParticleSource& source)
57 {
58   DALI_ASSERT_ALWAYS(source && "ParticleSource handle is empty");
59
60   const BaseObject& handle = source.GetBaseObject();
61
62   return static_cast<const Internal::ParticleSource&>(handle);
63 }
64
65 } // namespace Dali::Toolkit::ParticleSystem
66
67 #endif // DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_SOURCE_H