Moved OwnerContainer from internal to devel-api.
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / animator-connector-base.h
1 #ifndef __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__
2 #define __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/common/owner-pointer.h>
23 #include <dali/devel-api/common/owner-container.h>
24 #include <dali/public-api/animation/alpha-function.h>
25 #include <dali/public-api/animation/time-period.h>
26 #include <dali/public-api/common/dali-common.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 class Animation;
35 class AnimatorConnectorBase;
36
37 typedef OwnerPointer<AnimatorConnectorBase> AnimatorConnectorPtr;
38
39 typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
40
41 typedef AnimatorConnectorContainer::Iterator AnimatorConnectorIter;
42 typedef AnimatorConnectorContainer::ConstIterator AnimatorConnectorConstIter;
43
44 /**
45  * An abstract base class for animator connectors.
46  */
47 class AnimatorConnectorBase
48 {
49 public:
50
51   /**
52    * Constructor.
53    */
54   AnimatorConnectorBase(AlphaFunction alpha, const TimePeriod& period)
55   : mParent(NULL),
56     mAlphaFunction(alpha),
57     mTimePeriod(period)
58   {
59   }
60
61   /**
62    * Virtual destructor.
63    */
64   virtual ~AnimatorConnectorBase()
65   {
66   }
67
68   /**
69    * Set the parent of the AnimatorConnector.
70    * @pre The connector does not already have a parent.
71    * @param [in] parent The parent object.
72    */
73   virtual void SetParent(Animation& parent) = 0;
74
75   /**
76    * Retrieve the parent of the AnimatorConnector.
77    * @return The parent object, or NULL.
78    */
79   Animation* GetParent()
80   {
81     return mParent;
82   }
83
84 protected:
85
86   Animation* mParent; ///< The parent owns the connector.
87
88   AlphaFunction mAlphaFunction;
89   TimePeriod mTimePeriod;
90 };
91
92 } // namespace Internal
93
94 } // namespace Dali
95
96 #endif // __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__