#include <PagePool.h>

Collaboration diagram for Ipc::Mem::PagePool:

Public Types

typedef Ipc::Mem::Owner< PageStackOwner
 

Public Member Functions

 PagePool (const char *const id)
 
unsigned int capacity () const
 
size_t pageSize () const
 
unsigned int size () const
 lower bound for the number of free pages More...
 
size_t level () const
 approximate number of shared memory pages used now More...
 
size_t level (const int purpose) const
 approximate number of shared memory pages used now for given purpose More...
 
bool get (const PageId::Purpose purpose, PageId &page)
 sets page ID and returns true unless no free pages are found More...
 
void put (PageId &page)
 makes identified page available as a free page to future get() callers More...
 
char * pagePointer (const PageId &page)
 converts page handler into a temporary writeable shared memory pointer More...
 

Static Public Member Functions

static OwnerInit (const char *const shmId, const Ipc::Mem::PoolId stackId, const unsigned int capacity, const size_t pageSize)
 

Private Types

using Levels_t = PageStack::Levels_t
 

Private Attributes

Ipc::Mem::Pointer< PageStackpageIndex
 free pages index More...
 
Levels_t *const theLevels
 number of shared memory pages used now for each purpose More...
 
char *const theBuf
 pages storage More...
 

Detailed Description

Atomic container of shared memory pages. Implemented using a collection of Segments, each with a PageStack index of free pages. All pools must be created by a single process.

Definition at line 25 of file PagePool.h.

Member Typedef Documentation

◆ Levels_t

Definition at line 52 of file PagePool.h.

◆ Owner

Definition at line 28 of file PagePool.h.

Constructor & Destructor Documentation

◆ PagePool()

Ipc::Mem::PagePool::PagePool ( const char *const  id)

Definition at line 29 of file PagePool.cc.

Member Function Documentation

◆ capacity()

unsigned int Ipc::Mem::PagePool::capacity ( ) const
inline

Definition at line 34 of file PagePool.h.

References pageIndex.

Referenced by Init(), and level().

◆ get()

bool Ipc::Mem::PagePool::get ( const PageId::Purpose  purpose,
PageId page 
)

Definition at line 46 of file PagePool.cc.

References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.

Referenced by Ipc::Mem::GetPage().

◆ Init()

Ipc::Mem::PagePool::Owner * Ipc::Mem::PagePool::Init ( const char *const  shmId,
const Ipc::Mem::PoolId  stackId,
const unsigned int  capacity,
const size_t  pageSize 
)
static

◆ level() [1/2]

size_t Ipc::Mem::PagePool::level ( ) const
inline

Definition at line 39 of file PagePool.h.

References capacity(), and size().

Referenced by Ipc::Mem::PageLevel().

◆ level() [2/2]

size_t Ipc::Mem::PagePool::level ( const int  purpose) const

Definition at line 39 of file PagePool.cc.

References Ipc::Mem::PageId::maxPurpose, and Must.

◆ pagePointer()

char * Ipc::Mem::PagePool::pagePointer ( const PageId page)

Definition at line 70 of file PagePool.cc.

References Must, and Ipc::Mem::PageId::number.

Referenced by Ipc::Mem::PagePointer().

◆ pageSize()

size_t Ipc::Mem::PagePool::pageSize ( ) const
inline

Definition at line 35 of file PagePool.h.

References pageIndex.

Referenced by Init().

◆ put()

void Ipc::Mem::PagePool::put ( PageId page)

Definition at line 58 of file PagePool.cc.

References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.

Referenced by Ipc::Mem::PutPage().

◆ size()

unsigned int Ipc::Mem::PagePool::size ( ) const
inline

Definition at line 37 of file PagePool.h.

References pageIndex.

Referenced by level().

Member Data Documentation

◆ pageIndex

Ipc::Mem::Pointer<PageStack> Ipc::Mem::PagePool::pageIndex
private

Definition at line 51 of file PagePool.h.

Referenced by capacity(), pageSize(), and size().

◆ theBuf

char* const Ipc::Mem::PagePool::theBuf
private

Definition at line 56 of file PagePool.h.

◆ theLevels

Levels_t* const Ipc::Mem::PagePool::theLevels
private

Definition at line 55 of file PagePool.h.


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors