41#ifndef MEMHANDLEBASE_H_INCLUDED
42#define MEMHANDLEBASE_H_INCLUDED
53#include "memutils/common_utils/common_errcode.h"
70#ifdef USE_MEMMGR_SEG_DELETER
72 Manager::allocSeg(
id, size_for_check, m_proxy, use_deleter);
76 Manager::allocSeg(
id, size_for_check, m_proxy);
83 Manager::allocSeg(pool_id, size_for_check, m_proxy);
90 if (isAvail()) Manager::incSegRefCnt(getPoolId(), getSegNo());
97#ifdef USE_MEMMGR_SEG_DELETER
98 err_t
allocSeg(
PoolId id,
size_t size_for_check,
bool use_deleter =
false);
109 err_t
allocSeg(uint8_t
id,
size_t size_for_check){
113 return allocSeg(pool_id, size_for_check);
119 void freeSeg() {
if (isAvail()) Manager::freeSeg(*
this); }
121 bool isAvail()
const {
return m_proxy; }
122 bool isNull()
const {
return !isAvail(); }
123 bool isSame(
const MemHandleBase& mh) {
return m_proxy == mh.m_proxy; }
124 PoolId getPoolId()
const {
return m_seg_info.pool_id; }
125 NumSeg getSegNo()
const {
return m_seg_info.seg_no; }
126 uint8_t getFlags()
const {
return m_seg_info.flags; }
127#ifdef USE_MEMMGR_MULTI_CORE
128 CpuId getCpuId()
const {
return getFlags() & MaskCpuId; }
130 PoolAddr getAddr()
const {
return Manager::getSegAddr(*
this); }
131 PoolSize getSize()
const {
return Manager::getSegSize(*
this); }
132 SegRefCnt getRefCnt()
const {
return Manager::getSegRefCnt(getPoolId(), getSegNo()); }
135 friend class MemPool;
141#ifndef USE_MEMMGR_OVER255_SEGMENTS
150 static MemHandleProxy makeMemHandleProxy(PoolId
id, NumSeg seg_no, uint8_t flags) {
151 SegInfo seg = { id, flags, seg_no
152#ifndef USE_MEMMGR_OVER255_SEGMENTS
156 return *
reinterpret_cast<MemHandleProxy*
>(&seg);
159 void clear() { m_proxy = 0; }
164 MemHandleProxy m_proxy;
168S_ASSERT(
sizeof(MemHandleBase) == 4);
Memory Handler Base Class for Memory Handler Base Class. This class`s methods can called only from Me...
Definition: MemHandleBase.h:66
err_t allocSeg(PoolId id, size_t size_for_check)
void freeSeg()
Definition: MemHandleBase.h:119
namespace for "Memory Manager".
Definition: MemMgrTypes.h:88