Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SourcePositionCache Class Reference

Internally used source position cache for fewer memory comsumption. More...

#include <spcache.h>

Collaboration diagram for SourcePositionCache:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SourcePositionCache ()
 ~SourcePositionCache ()
void store (const SourcePosition &sp)
SourcePosition find (int line, int lpos)

Private Attributes

SourcePosition cache [cache_size]
int top
int hits
int misses

Static Private Attributes

const int cache_size = 6

Detailed Description

Internally used source position cache for fewer memory comsumption.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Used internally to cache the last couple of returned source positions so that equal positions can use the same reference.

Not "C++-safe"; not thread-safe.

Definition at line 43 of file spcache.h.


Constructor & Destructor Documentation

SourcePositionCache::SourcePositionCache  ) 
 

Definition at line 44 of file spcache.cc.

References hits, misses, and top.

SourcePositionCache::~SourcePositionCache  ) 
 

Definition at line 52 of file spcache.cc.

References hits, and misses.


Member Function Documentation

SourcePosition SourcePositionCache::find int  line,
int  lpos
 

Todo:
remove stdio.h (only needed for debug).

Definition at line 24 of file spcache.cc.

References cache, cache_size, hits, misses, SourcePosition, and top.

void SourcePositionCache::store const SourcePosition sp  )  [inline]
 

Definition at line 66 of file spcache.h.

References cache, cache_size, SourcePosition, and top.


Member Data Documentation

SourcePosition SourcePositionCache::cache[cache_size] [private]
 

Definition at line 51 of file spcache.h.

Referenced by find(), and store().

const int SourcePositionCache::cache_size = 6 [static, private]
 

Definition at line 50 of file spcache.h.

Referenced by find(), and store().

int SourcePositionCache::hits [private]
 

Definition at line 57 of file spcache.h.

Referenced by find(), SourcePositionCache(), and ~SourcePositionCache().

int SourcePositionCache::misses [private]
 

Definition at line 58 of file spcache.h.

Referenced by find(), SourcePositionCache(), and ~SourcePositionCache().

int SourcePositionCache::top [private]
 

Definition at line 54 of file spcache.h.

Referenced by find(), SourcePositionCache(), and store().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:40 2005 for Ray by doxygen 1.3.5