CacheBuffer Class Reference

#include <CacheBuffer.h>

List of all members.

Private Member Functions

 CacheBuffer ()
 CacheBuffer (unsigned int autoclear_limit)
 ~CacheBuffer ()
void AddToCache (double e, double de_dx)
bool Retrieve (double e, double &de_dx) const
void ClearCache (void)
void Print (const Option_t *) const

Private Attributes

map< double, double > fCache
map< double, double >::size_type fCacheSize
unsigned int fAutoclearLimit

Friends

class Cache
ostream & operator<< (ostream &stream, const CacheBuffer &buffer)

Detailed Description

________________________________________________________________________________________

Id
CacheBuffer.cxx,v 1.2 2004/01/05 16:11:13 costas Exp

________________________________________________________________________________________

Id
CacheBuffer.h,v 1.2 2004/01/05 16:11:13 costas Exp

Definition at line 27 of file CacheBuffer.h.


Constructor & Destructor Documentation

CacheBuffer::CacheBuffer (  )  [private]

Definition at line 30 of file CacheBuffer.cxx.

References fAutoclearLimit, fCache, and fCacheSize.

00031 {
00032   fCacheSize      = fCache.size();
00033   fAutoclearLimit = 1000;
00034 }

CacheBuffer::CacheBuffer ( unsigned int  autoclear_limit  )  [private]

Definition at line 36 of file CacheBuffer.cxx.

References fCache, and fCacheSize.

00036                                                      :
00037 fAutoclearLimit(autoclear_limit)
00038 {
00039   fCacheSize = fCache.size();
00040 }
//_________________________________________________________________________________________

CacheBuffer::~CacheBuffer (  )  [private]

Definition at line 42 of file CacheBuffer.cxx.

00043 {
00044   
00045 }


Member Function Documentation

void CacheBuffer::AddToCache ( double  e,
double  de_dx 
) [private]

Definition at line 47 of file CacheBuffer.cxx.

References fAutoclearLimit, fCache, and fCacheSize.

00048 {
00049   fCacheSize = fCache.size();
00050 
00051   // check cache buffer size, 0 disables auto-clear 
00052   if(fCacheSize > fAutoclearLimit && fAutoclearLimit != 0) fCache.clear();
00053 
00054   fCache.insert( map<double, double>::value_type(e, de_dx) );
00055 }

void CacheBuffer::ClearCache ( void   )  [private]

Definition at line 68 of file CacheBuffer.cxx.

References fCache.

00069 {
00070   fCache.clear();
00071 }

void CacheBuffer::Print ( const Option_t *   )  const [private]

Definition at line 73 of file CacheBuffer.cxx.

00074 {
00075   cout << *this;
00076 }

bool CacheBuffer::Retrieve ( double  e,
double &  de_dx 
) const [private]

Definition at line 57 of file CacheBuffer.cxx.

References fCache.

00058 {
00059   if( fCache.count(e) == 1) {
00060      map<double, double>::const_iterator iter = fCache.find(e);
00061      de_dx = iter->second;
00062      return true;
00063   }
00064   de_dx = 0;
00065   return false;   
00066 }


Friends And Related Function Documentation

friend class Cache [friend]

Definition at line 31 of file CacheBuffer.h.

ostream& operator<< ( ostream &  stream,
const CacheBuffer buffer 
) [friend]

Member Data Documentation

unsigned int CacheBuffer::fAutoclearLimit [private]

Definition at line 47 of file CacheBuffer.h.

Referenced by AddToCache(), and CacheBuffer().

map<double, double> CacheBuffer::fCache [private]

Definition at line 45 of file CacheBuffer.h.

Referenced by AddToCache(), CacheBuffer(), ClearCache(), and Retrieve().

map<double, double>::size_type CacheBuffer::fCacheSize [private]

Definition at line 46 of file CacheBuffer.h.

Referenced by AddToCache(), and CacheBuffer().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1