[4.0] Changed Update to reset only target properties each frame
[platform/core/uifw/dali-core.git] / dali / internal / update / animation / scene-graph-constraint-base.cpp
1 /*
2  * Copyright (c) 2018 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
24 namespace Internal
25 {
26
27 namespace SceneGraph
28 {
29
30 #ifdef DEBUG_ENABLED
31   unsigned int ConstraintBase::mCurrentInstanceCount = 0;
32   unsigned int ConstraintBase::mTotalInstanceCount   = 0;
33 #endif
34
35 ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet, RemoveAction removeAction )
36 : mRemoveAction( removeAction ),
37   mFirstApply( true ),
38   mDisconnected( true ),
39   mObservedOwners( ownerSet ),
40   mLifecycleObserver( nullptr )
41 {
42 #ifdef DEBUG_ENABLED
43   ++mCurrentInstanceCount;
44   ++mTotalInstanceCount;
45 #endif
46 }
47
48 ConstraintBase::~ConstraintBase()
49 {
50   if ( !mDisconnected )
51   {
52     StopObservation();
53   }
54
55   if( mLifecycleObserver != nullptr )
56   {
57     mLifecycleObserver->ObjectDestroyed();
58   }
59
60 #ifdef DEBUG_ENABLED
61   --mCurrentInstanceCount;
62 #endif
63 }
64
65 unsigned int ConstraintBase::GetCurrentInstanceCount()
66 {
67 #ifdef DEBUG_ENABLED
68   return mCurrentInstanceCount;
69 #else
70   return 0u;
71 #endif
72 }
73
74 unsigned int ConstraintBase::GetTotalInstanceCount()
75 {
76 #ifdef DEBUG_ENABLED
77   return mTotalInstanceCount;
78 #else
79   return 0u;
80 #endif
81 }
82
83 } // namespace SceneGraph
84
85 } // namespace Internal
86
87 } // namespace Dali