ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
LWPoolAreaBookKeeper Class Reference

#include <LWPoolAreaBookKeeper.h>

Collaboration diagram for LWPoolAreaBookKeeper:

Public Member Functions

unsigned nBytesCovered () const
 
unsigned acquireEntry ()
 
void returnEntry (unsigned)
 
bool isCompletelyFull () const
 
bool isCompletelyEmpty () const
 
unsigned numberOfAvailableEntries () const
 
unsigned numberOfEntriesHandedOut () const
 

Static Public Member Functions

static unsigned nBytesNeededForCreate (unsigned nEntries)
 
static LWPoolAreaBookKeepercreate (char *, unsigned nEntries)
 

Private Types

typedef unsigned BitField
 

Private Member Functions

 LWPoolAreaBookKeeper (unsigned nEntries)
 
 ~LWPoolAreaBookKeeper ()
 
 LWPoolAreaBookKeeper (const LWPoolAreaBookKeeper &)
 
LWPoolAreaBookKeeperoperator= (const LWPoolAreaBookKeeper &)
 
void findNewNonEmptyField ()
 

Static Private Member Functions

static unsigned nFields (unsigned nEntries)
 

Private Attributes

const unsigned m_nEntries
 
const unsigned m_nFields
 
unsigned m_nonEmptyField
 
unsigned m_nUnusedEntries
 

Friends

class LWPoolArea
 

Detailed Description

Definition at line 30 of file LWPoolAreaBookKeeper.h.

Member Typedef Documentation

◆ BitField

typedef unsigned LWPoolAreaBookKeeper::BitField
private

Definition at line 48 of file LWPoolAreaBookKeeper.h.

Constructor & Destructor Documentation

◆ LWPoolAreaBookKeeper() [1/2]

LWPoolAreaBookKeeper::LWPoolAreaBookKeeper ( unsigned  nEntries)
private

Definition at line 49 of file LWPoolAreaBookKeeper.cxx.

50  : //m_fields(0),
53  m_nonEmptyField(0),
55 {
56  assert(CHAR_BIT==8);//Likely to have bugs if CHAR_BIT!=8
57  memset(LW_FIELDS,0xFF,m_nFields*sizeof(LW_FIELDS[0]));//set all bits (0xFF is 8 bits)
58  const unsigned nlast(nEntries%LW_ENTRIESPERGROUP);
59  if (nlast)
60  LW_FIELDS[m_nFields-1] >>= (LW_ENTRIESPERGROUP-nlast);//Only set the 'nlast' least significant bits
61 }

◆ ~LWPoolAreaBookKeeper()

LWPoolAreaBookKeeper::~LWPoolAreaBookKeeper ( )
inlineprivate

Definition at line 59 of file LWPoolAreaBookKeeper.h.

59 {}

◆ LWPoolAreaBookKeeper() [2/2]

LWPoolAreaBookKeeper::LWPoolAreaBookKeeper ( const LWPoolAreaBookKeeper )
private

Member Function Documentation

◆ acquireEntry()

unsigned LWPoolAreaBookKeeper::acquireEntry ( )

◆ create()

LWPoolAreaBookKeeper * LWPoolAreaBookKeeper::create ( char *  c,
unsigned  nEntries 
)
static

Definition at line 43 of file LWPoolAreaBookKeeper.cxx.

44 {
45  return new(c) LWPoolAreaBookKeeper(nEntries);
46 }

◆ findNewNonEmptyField()

void LWPoolAreaBookKeeper::findNewNonEmptyField ( )
private

Definition at line 64 of file LWPoolAreaBookKeeper.cxx.

65 {
66  assert(!LW_FIELDS[m_nonEmptyField]);
67  //For cache-locality reasons we first look in the following
68  //fields, then start from 0:
69  unsigned newNonEmptyField = UINT_MAX;
70  for (unsigned iField = m_nonEmptyField+1; iField<m_nFields;++iField) {
71  if (LW_FIELDS[iField]) {
72  newNonEmptyField = iField;
73  break;
74  }
75  }
76  if (newNonEmptyField==UINT_MAX)
77  for (unsigned iField = 0; iField<m_nonEmptyField;++iField) {
78  if (LW_FIELDS[iField]) {
79  newNonEmptyField = iField;
80  break;
81  }
82  }
83  m_nonEmptyField = newNonEmptyField;
84  assert(m_nonEmptyField==UINT_MAX||LW_FIELDS[m_nonEmptyField]);
85 }

◆ isCompletelyEmpty()

bool LWPoolAreaBookKeeper::isCompletelyEmpty ( ) const

◆ isCompletelyFull()

bool LWPoolAreaBookKeeper::isCompletelyFull ( ) const

◆ nBytesCovered()

unsigned LWPoolAreaBookKeeper::nBytesCovered ( ) const

Definition at line 37 of file LWPoolAreaBookKeeper.cxx.

38 {
40 }

◆ nBytesNeededForCreate()

unsigned LWPoolAreaBookKeeper::nBytesNeededForCreate ( unsigned  nEntries)
static

Definition at line 25 of file LWPoolAreaBookKeeper.cxx.

26 {
27  return (nFields(nEntries)*sizeof(BitField)+sizeof(LWPoolAreaBookKeeper) + 7) & ~7;
28 }

◆ nFields()

unsigned LWPoolAreaBookKeeper::nFields ( unsigned  nEntries)
staticprivate

Definition at line 31 of file LWPoolAreaBookKeeper.cxx.

32 {
34 }

◆ numberOfAvailableEntries()

unsigned LWPoolAreaBookKeeper::numberOfAvailableEntries ( ) const

◆ numberOfEntriesHandedOut()

unsigned LWPoolAreaBookKeeper::numberOfEntriesHandedOut ( ) const

◆ operator=()

LWPoolAreaBookKeeper& LWPoolAreaBookKeeper::operator= ( const LWPoolAreaBookKeeper )
private

◆ returnEntry()

void LWPoolAreaBookKeeper::returnEntry ( unsigned  )

Friends And Related Function Documentation

◆ LWPoolArea

friend class LWPoolArea
friend

Definition at line 50 of file LWPoolAreaBookKeeper.h.

Member Data Documentation

◆ m_nEntries

const unsigned LWPoolAreaBookKeeper::m_nEntries
private

Definition at line 52 of file LWPoolAreaBookKeeper.h.

◆ m_nFields

const unsigned LWPoolAreaBookKeeper::m_nFields
private

Definition at line 53 of file LWPoolAreaBookKeeper.h.

◆ m_nonEmptyField

unsigned LWPoolAreaBookKeeper::m_nonEmptyField
private

Definition at line 54 of file LWPoolAreaBookKeeper.h.

◆ m_nUnusedEntries

unsigned LWPoolAreaBookKeeper::m_nUnusedEntries
private

Definition at line 55 of file LWPoolAreaBookKeeper.h.


The documentation for this class was generated from the following files:
LWPoolAreaBookKeeper::m_nUnusedEntries
unsigned m_nUnusedEntries
Definition: LWPoolAreaBookKeeper.h:55
LWPoolAreaBookKeeper::LWPoolAreaBookKeeper
LWPoolAreaBookKeeper(unsigned nEntries)
Definition: LWPoolAreaBookKeeper.cxx:49
LWPoolAreaBookKeeper::m_nEntries
const unsigned m_nEntries
Definition: LWPoolAreaBookKeeper.h:52
LWPoolAreaBookKeeper
Definition: LWPoolAreaBookKeeper.h:30
LWPoolAreaBookKeeper::nBytesNeededForCreate
static unsigned nBytesNeededForCreate(unsigned nEntries)
Definition: LWPoolAreaBookKeeper.cxx:25
BitField
Definition: ZdcWordDecoder.h:14
LWPoolAreaBookKeeper::m_nFields
const unsigned m_nFields
Definition: LWPoolAreaBookKeeper.h:53
LWPoolAreaBookKeeper::m_nonEmptyField
unsigned m_nonEmptyField
Definition: LWPoolAreaBookKeeper.h:54
LW_FIELDS
#define LW_FIELDS
Definition: LWPoolAreaBookKeeper.cxx:22
LW_ENTRIESPERGROUP
#define LW_ENTRIESPERGROUP
Definition: LWPoolAreaBookKeeper.h:64
LWPoolAreaBookKeeper::nFields
static unsigned nFields(unsigned nEntries)
Definition: LWPoolAreaBookKeeper.cxx:31
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
python.compressB64.c
def c
Definition: compressB64.py:93