Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_error_allocator.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00003
    00004 //               O S C L _ E R R O R _ A L L O C A T O R
    00005
    00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00007
    00019 #ifndef OSCL_ERROR_ALLOCATOR_H_INCLUDED
    00020 #define OSCL_ERROR_ALLOCATOR_H_INCLUDED
    00021
    00022 // - - Inclusion - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    00023
    00024 #ifndef OSCL_BASE_H_INCLUDED
    00025 #include "oscl_base.h"
    00026 #endif
    00027
    00028 #ifndef OSCL_BASE_MACROS_H_INCLUDED
    00029 #include "oscl_base_macros.h"
    00030 #endif
    00031
    00032 #ifndef OSCLCONFIG_ERROR_H_INCLUDED
    00033 #include "osclconfig_error.h"
    00034 #endif
    00035
    00036 #ifndef OSCL_ASSERT_H_INCLUDED
    00037 #include "oscl_assert.h"
    00038 #endif
    00039
    00040 #ifndef OSCL_DEFALLOC_H_INCLUDED
    00041 #include "oscl_defalloc.h"
    00042 #endif
    00043
    00044
    00046
    00049 class OsclErrorAllocator
    00050 {
    00051     public:
    00053
    00056         OsclErrorAllocator(Oscl_DefAlloc* allocator)
    00057         {
    00058             iAllocator = allocator;
    00059         }
    00061
    00064         static OsclAny* allocate(uint32 aSize)
    00065         {
    00066             OSCL_ASSERT(iAllocator != NULL);
    00067             return iAllocator->ALLOCATE(aSize);
    00068         }
    00069
    00071
    00074         static OsclAny deallocate(OsclAny* aPointer)
    00075         {
    00076             OSCL_ASSERT(iAllocator != NULL);
    00077             iAllocator->deallocate(aPointer);
    00078         }
    00079
    00081         void* operator new(uint32 size, OsclAny* aPtr)
    00082         {
    00083             OSCL_UNUSED_ARG(size);
    00084             return aPtr;
    00085         }
    00086
    00088         void operator delete(OsclAny* aPtr, OsclAny* aPtr2)
    00089         {
    00090             OSCL_UNUSED_ARG(aPtr);
    00091             OSCL_UNUSED_ARG(aPtr2);
    00092         }
    00093
    00094     private:
    00095         static Oscl_DefAlloc* iAllocator;
    00096 };
    00097
    00098
    00099
    00100 #endif  //OSCL_ERROR_ALLOCATOR_H_INCLUDED
    00101