License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / update / resources / resource-tracker.h
1 #ifndef __DALI_INTERNAL_RESOURCE_TRACKER_H__
2 #define __DALI_INTERNAL_RESOURCE_TRACKER_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 #include <dali/integration-api/resource-declarations.h>
22 #include <dali/internal/update/common/scene-graph-buffers.h>
23
24 namespace Dali
25 {
26 namespace Integration
27 {
28 class GlSyncAbstraction;
29 }
30
31 namespace Internal
32 {
33
34 namespace SceneGraph
35 {
36 class RenderTracker;
37 class RenderMessageDispatcher;
38 }
39
40 /**
41  * Class to track completion of a resource.
42  * Created for resource objects that can change completion status during update passes,
43  * such as chained framebuffers. This base class is designed to be used on resources that
44  * change completion in the update thread.
45  */
46 class ResourceTracker
47 {
48 public:
49   /**
50    * Constructor
51    */
52   ResourceTracker();
53
54   /**
55    * Destructor
56    */
57   virtual ~ResourceTracker();
58
59   /**
60    * Second stage initialization
61    */
62   virtual void Initialize();
63
64   /**
65    * first stage destruction
66    * Called from CompleteStatusManager when the object is about to be deleted
67    */
68   virtual void OnDestroy();
69
70   /**
71    * Reset the tracker
72    */
73   void Reset();
74
75   /**
76    * Set the tracker to be complete (Derived types may ignore this)
77    */
78   void SetComplete( );
79
80   /**
81    * @return TRUE if the resource is complete
82    */
83   bool IsComplete();
84
85 protected:
86   /**
87    * Do the reset. Allows derived types to handle the reset themselves.
88    */
89   virtual void DoReset();
90
91   /**
92    * Do the SetComplete. Allows derived types to handle the completeness themselves.
93    */
94   virtual void DoSetComplete();
95
96   /**
97    * Do the IsComplete. Allows derived types to perform their own handling
98    */
99   virtual bool DoIsComplete();
100
101   bool mComplete; ///< TRUE if tracked resource has completed
102
103 private:
104   /**
105    * Undefined Copy Constructor and assignment operator
106    */
107   ResourceTracker(const ResourceTracker& rhs);
108   ResourceTracker& operator=(const ResourceTracker& rhs);
109 };
110
111
112
113 } // Internal
114 } // Dali
115
116 #endif // __DALI_INTERNAL_RESOURCE_TRACKER_H__