1 #ifndef GAME_CONTAINER_H
2 #define GAME_CONTAINER_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/public-api/common/dali-vector.h>
24 * GameContainer is a vector which owns heap-allocated objects.
25 * Unlike vector this will call delete on the stored pointers during destruction.
26 * For example, you can define a vector of heap-allocated Node objects:
28 * typedef GameContainer< GameEntity* > EntityArray;
30 * EntityArray entites;
31 * entites.PushBack( new GameEntity() );
32 * // container is now responsible for calling delete on GameEntity
37 class GameContainer : public Dali::Vector<T>
40 typedef typename Dali::Vector<T>::Iterator Iterator;
41 typedef typename Dali::Vector<T>::ConstIterator ConstIterator;
44 * Create a owner container.
51 * Non-virtual destructor; GameCache<T> is not suitable as base class.
56 Dali::VectorBase::Release();
60 * Destroy all of the elements in the container.
64 ConstIterator end = Dali::Vector<T>::End();
65 for(Iterator iter = Dali::Vector<T>::Begin(); iter != end; ++iter)
69 Dali::Vector<T>::Clear();
73 // Undefined copy constructor.
74 GameContainer(const GameContainer&);
76 // Undefined assignment operator.
77 GameContainer& operator=(const GameContainer&);