• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
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
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 // -*- c++ -*-
19 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
20 
21 //               O S C L _ M E M P O O L _ A L L O C A T O R
22 
23 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
24 
25 /*! \addtogroup osclerror OSCL Error
26  *
27  * @{
28  */
29 
30 
31 /*! \file oscl_mempool_allocator.h
32     \brief This file contains the definition of memory pool allocator for leave/trap
33 */
34 
35 /***************************************************************************************
36 File Name       : oscl_mempool_allocator.h
37 Description     : File containing definition of class OsclMemPoolAllocator that provides
38                   methods for creating, deleting memory pool.
39 Coding History  :
40                   Achint Kaur           April 11, 2006      Initial Draft
41 ***************************************************************************************/
42 #ifndef OSCL_MEMPOOL_ALLOCATOR_H_INCLUDED
43 #define OSCL_MEMPOOL_ALLOCATOR_H_INCLUDED
44 
45 #ifndef OSCL_DEFALLOC_H_INCLUDED
46 // For custom allocator Oscl_DefAlloc object
47 #include "oscl_defalloc.h"
48 #endif
49 
50 class OsclMemPoolAllocator
51 {
52     public:
53         // Constructor
54         OsclMemPoolAllocator(Oscl_DefAlloc* gen_alloc = NULL);
55 
56         // Virtual destructor
57         virtual ~OsclMemPoolAllocator();
58 
59         // Create memory pool
60         OsclAny* CreateMemPool(const uint32 aNumChunk = 2, const uint32 aChunkSize = 4);
61 
62         // Delete memory pool
63         void DestroyMemPool();
64 
65         // Memory alignment
66         uint oscl_mem_aligned_size(uint size);
67 
68     private:
69         // Custom allocator for memory
70         Oscl_DefAlloc* iCustomAllocator;
71 
72         // Base address for memory pool
73         OsclAny* iBaseAddress;
74 
75 };
76 
77 #endif
78