Dali 3D User Interface Engine
test-gl-sync-abstraction.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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 
19 
20 namespace Dali
21 {
22 
24 : synced(false),
25  mTrace(trace)
26 {
27 }
28 
30 {
31 }
32 
34 {
35  mTrace.PushCall("SyncObject::IsSynced", ""); // Trace the method
36  return synced;
37 }
38 
39 
40 
42 {
43  Initialize();
44 }
45 
50 {
51  for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
52  {
53  delete *iter;
54  }
55 }
56 
61 {
62  mSyncObjects.clear();
63 }
64 
70 {
71  mTrace.PushCall("CreateSyncObject", ""); // Trace the method
72 
73  TestSyncObject* syncObject = new TestSyncObject(mTrace);
74  mSyncObjects.push_back( syncObject );
75  return syncObject;
76 }
77 
83 {
84  std::stringstream out;
85  out << syncObject;
86  mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
87 
88  for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
89  {
90  if( *iter == syncObject )
91  {
92  delete *iter;
93  mSyncObjects.erase(iter);
94  break;
95  }
96  }
97 }
98 
99 
101 {
102  if( !mSyncObjects.empty() )
103  {
104  return mSyncObjects.back();
105  }
106  return NULL;
107 }
108 
115 {
116  TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
117  testSyncObject->synced = sync;
118 }
119 
123 void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
124 
129 
134 
136 {
137  return mSyncObjects.size();
138 }
139 
140 
141 } // Dali
Dali Docs Home
Read more about Dali