UTGUIPoolAllocator.h

Go to the documentation of this file.
00001 //==================================================================================================
00002 // Copyright (C) 2010  Brian Tietz    sdbtietz at yahoo dot com
00003 //
00004 // This program is free software; you can redistribute it and/or modify it under the terms of the
00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the
00006 // License.
00007 //
00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010 // General Public License for more details.
00011 //
00012 // You should have received a copy of the GNU General Public License along with this program; if
00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00014 // 02110-1301, USA.
00015 //
00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com)
00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that
00018 // license as applied to the UT library in exchange for either substantial contributions to the
00019 // development of the UT library or other forms of compensation.  Any such waiver must be
00020 // established in writing between the copyright holder and the commercial entity obtaining such a
00021 // waiver.
00022 //==================================================================================================
00023 
00024 
00025 #ifndef _UT_GUI_POOL_ALLOCATOR_H_
00026 #define _UT_GUI_POOL_ALLOCATOR_H_
00027 
00030 
00031 
00032 //==================================================================================================
00033 //=== Project headers
00034 //==================================================================================================
00035 #include "UTgui.h"
00036 #include "UTPoolAllocator.h"
00037 #include "UTThread.h"
00038 
00039 
00040 //==================================================================================================
00041 class UTGUI_EXPORT GUIPoolAllocator_t
00042 //==================================================================================================
00054 : private PoolAllocator_t
00055 {
00056     //----------------------------------------------------------------------------------------------
00057     public:
00058     //----------------------------------------------------------------------------------------------
00059                     GUIPoolAllocator_t();
00061 
00062                     ~GUIPoolAllocator_t();
00064 
00065     inline void*    Allocate(size_t size);
00067 
00068     inline void     Release(void* block);
00070 };
00071 
00072 
00079 extern UTGUI_EXPORT GUIPoolAllocator_t g_gui_pool_allocator;
00080 
00081 
00082 
00083 
00084 //==================================================================================================
00085 //==================================================================================================
00086 //===
00087 //=== Inline function implementations
00088 //===
00089 //==================================================================================================
00090 //==================================================================================================
00091 inline void*
00092 GUIPoolAllocator_t::Allocate(size_t size)
00093 {
00094     assert( current_thread_id() == Thread_t::MainThreadId() );
00095     return PoolAllocator_t::Allocate(size);
00096 }
00097 
00098 
00099 inline void
00100 GUIPoolAllocator_t::Release(void* block)
00101 {
00102     assert( current_thread_id() == Thread_t::MainThreadId() );
00103     return PoolAllocator_t::Release(block);
00104 }
00105 
00106 
00107 #endif // _UT_GUI_POOL_ALLOCATOR_H_

Generated on Tue Dec 14 22:35:05 2010 for UT library by  doxygen 1.6.1