📄 umc_memory_allocator.h
字号:
/*
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright (c) 2006 Intel Corporation. All Rights Reserved.
//
*/
#ifndef __UMC_MEMORY_ALLOCATOR_H__
#define __UMC_MEMORY_ALLOCATOR_H__
#include "ippdefs.h"
#include "umc_structures.h"
#include "umc_dynamic_cast.h"
#define MID_INVALID 0
namespace UMC
{
typedef Ipp32u MemID;
enum UMC_ALLOC_FLAGS
{
UMC_ALLOC_PERSISTENT = 0x01,
UMC_ALLOC_FUNCLOCAL = 0x02
};
class MemoryAllocatorParams
{
DYNAMIC_CAST_DECL_BASE(MemoryAllocatorParams)
public:
MemoryAllocatorParams(){}
virtual ~MemoryAllocatorParams(){}
};
class MemoryAllocator
{
DYNAMIC_CAST_DECL_BASE(MemoryAllocator)
public:
MemoryAllocator(void){}
virtual ~MemoryAllocator(void){}
// Initiates object
virtual Status Init(MemoryAllocatorParams *pParams) = 0;
// Closes object and releases all allocated memory
virtual Status Close() = 0;
// Allocates or reserves physical memory and returns unique ID
// Sets lock counter to 0
virtual Status Alloc(MemID *pNewMemID, size_t Size, Ipp32u Flags, Ipp32u Align = 16) = 0;
// Lock() provides pointer from ID. If data is not in memory (swapped)
// prepares (restores) it. Increases lock counter
virtual void* Lock(MemID MID) = 0;
// Unlock() decreases lock counter
virtual Status Unlock(MemID MID) = 0;
// Notifies that the data won抰 be used anymore. Memory can be freed.
virtual Status Free(MemID MID) = 0;
// Immediately deallocates memory regardless of whether it is in use (locked) or no
virtual Status DeallocateMem(MemID MID) = 0;
};
} //namespace UMC
#endif //__UMC_MEMORY_ALLOCATOR_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -