1 #ifndef __DALI_INTERNAL_MEMORY_POOL_RELAYOUT_CONTAINER_H__
2 #define __DALI_INTERNAL_MEMORY_POOL_RELAYOUT_CONTAINER_H__
5 * Copyright (c) 2015 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.
23 #include <dali/public-api/size-negotiation/relayout-container.h>
24 #include <dali/public-api/common/dali-vector.h>
25 #include <dali/public-api/actors/actor.h>
27 #include <dali/internal/common/memory-pool-object-allocator.h>
36 * @brief Container to encapsulate information required for relayout.
38 * Uses a memory pool to manage data allocations.
40 class MemoryPoolRelayoutContainer : public RelayoutContainer
45 * Struct to store the relayout information
49 Dali::Actor actor; ///< The actor to relayout
50 Vector2 size; ///< The desired size of the actor
54 * @brief Default constructor
56 * @param objectAllocator A memory pool that can allocate memory for RelayoutInfos
58 MemoryPoolRelayoutContainer( MemoryPoolObjectAllocator< RelayoutInfo >& objectAllocator );
63 virtual ~MemoryPoolRelayoutContainer();
66 * @brief Add relayout information to the container if it does'nt already exist
68 * @param actor The actor to relayout
69 * @param size The size to relayout
71 virtual void Add( const Dali::Actor& actor, const Vector2& size );
74 * @brief Remove information from the container
79 * @brief Retrieve relayout information for the given index
81 * @param index The index of the information to retrieve
83 void Get( size_t index, Dali::Actor& actorOut, Vector2& sizeOut ) const;
86 * @brief The count of information in the container
91 * @brief Set the capacity of the container
93 * @param capacity The new capacity for the container
95 void Reserve( size_t capacity );
98 * @brief Reset the container, freeing all memory
103 * @brief Returns if the container contains the actor or not
105 * @param actor The actor to search for
106 * @return Return if the actor was found or not
108 bool Contains( const Dali::Actor& actor );
112 typedef Vector< RelayoutInfo* > RelayoutInfoContainer;
114 RelayoutInfoContainer mRelayoutInfos; ///< The list of relayout infos
116 MemoryPoolObjectAllocator< RelayoutInfo >& mAllocator; ///< The memory pool from which the infos are allocated
119 } // namespace Internal
123 #endif // __DALI_INTERNAL_MEMORY_POOL_RELAYOUT_CONTAINER_H__