Support Animation Blend for AnimateBetween
[platform/core/uifw/dali-core.git] / dali / internal / update / animation / scene-graph-constraint-base.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/update/animation/scene-graph-constraint.h>
20
21 namespace Dali
22 {
23 namespace Internal
24 {
25 namespace SceneGraph
26 {
27 #ifdef DEBUG_ENABLED
28 uint32_t ConstraintBase::mCurrentInstanceCount = 0;
29 uint32_t ConstraintBase::mTotalInstanceCount   = 0;
30 #endif
31
32 ConstraintBase::ConstraintBase(PropertyOwnerContainer& ownerSet, RemoveAction removeAction)
33 : mRemoveAction(removeAction),
34   mFirstApply(true),
35   mDisconnected(true),
36   mObservedOwners(ownerSet),
37   mLifecycleObserver(nullptr)
38 {
39 #ifdef DEBUG_ENABLED
40   ++mCurrentInstanceCount;
41   ++mTotalInstanceCount;
42 #endif
43 }
44
45 ConstraintBase::~ConstraintBase()
46 {
47   if(!mDisconnected)
48   {
49     StopObservation();
50   }
51
52   if(mLifecycleObserver != nullptr)
53   {
54     mLifecycleObserver->ObjectDestroyed();
55   }
56
57 #ifdef DEBUG_ENABLED
58   --mCurrentInstanceCount;
59 #endif
60 }
61
62 uint32_t ConstraintBase::GetCurrentInstanceCount()
63 {
64 #ifdef DEBUG_ENABLED
65   return mCurrentInstanceCount;
66 #else
67   return 0u;
68 #endif
69 }
70
71 uint32_t ConstraintBase::GetTotalInstanceCount()
72 {
73 #ifdef DEBUG_ENABLED
74   return mTotalInstanceCount;
75 #else
76   return 0u;
77 #endif
78 }
79
80 } // namespace SceneGraph
81
82 } // namespace Internal
83
84 } // namespace Dali