oasys::PointerCache< _Name, _PtrType > Class Template Reference

#include <PointerCache.h>

List of all members.


Detailed Description

template<typename _Name, typename _PtrType>
class oasys::PointerCache< _Name, _PtrType >

A cache of pointers with a at_limit() predicate that is called when with each new allocation to decide which pointer to evict. Reinstate is called to revive evicted objects.

Definition at line 19 of file PointerCache.h.

Public Member Functions

 PointerCache ()
virtual ~PointerCache ()
PointerCacheoperator= (_PtrType *ptr)
PointerCacheoperator= (const PointerCache &)
 Not implemented to make this illegal.
_PtrType * ptr ()
 
Returns:
Original pointer

_PtrType & operator * () const
 referencing operations will resurrect pointers if need be
_PtrType * operator-> () const
 referencing operations will resurrect pointers if need be

Protected Member Functions

virtual void restore_and_update_ptr ()=0
virtual bool at_limit (_PtrType *ptr)=0
virtual void evict ()=0
virtual void register_ptr (_PtrType *ptr)=0
virtual void unregister_ptr (_PtrType *ptr)=0
void set_ptr (_PtrType *ptr)

Protected Attributes

_PtrType * ptr_


Constructor & Destructor Documentation

template<typename _Name, typename _PtrType>
oasys::PointerCache< _Name, _PtrType >::PointerCache (  )  [inline]

Adds the pointer to the cache.

Definition at line 24 of file PointerCache.h.

template<typename _Name, typename _PtrType>
virtual oasys::PointerCache< _Name, _PtrType >::~PointerCache (  )  [inline, virtual]

Unregisters the contained pointer from the cache.

Definition at line 37 of file PointerCache.h.


Member Function Documentation

template<typename _Name, typename _PtrType>
_PtrType& oasys::PointerCache< _Name, _PtrType >::operator * (  )  const [inline]

referencing operations will resurrect pointers if need be

Definition at line 48 of file PointerCache.h.

References oasys::PointerCache< _Name, _PtrType >::ptr_, and oasys::PointerCache< _Name, _PtrType >::restore_and_update_ptr().

template<typename _Name, typename _PtrType>
_PtrType* oasys::PointerCache< _Name, _PtrType >::operator-> (  )  const [inline]

referencing operations will resurrect pointers if need be

Definition at line 52 of file PointerCache.h.

References oasys::PointerCache< _Name, _PtrType >::ptr_, and oasys::PointerCache< _Name, _PtrType >::restore_and_update_ptr().

template<typename _Name, typename _PtrType>
PointerCache& oasys::PointerCache< _Name, _PtrType >::operator= ( _PtrType *  ptr  )  [inline]

Set the contained pointer to something else. Replaces the contained pointer in the cache with the new pointer.

Definition at line 62 of file PointerCache.h.

References oasys::PointerCache< _Name, _PtrType >::set_ptr().

template<typename _Name, typename _PtrType>
PointerCache& oasys::PointerCache< _Name, _PtrType >::operator= ( const PointerCache< _Name, _PtrType > &   ) 

Not implemented to make this illegal.

template<typename _Name, typename _PtrType>
_PtrType* oasys::PointerCache< _Name, _PtrType >::ptr (  )  [inline]

Returns:
Original pointer

Definition at line 71 of file PointerCache.h.

References oasys::PointerCache< _Name, _PtrType >::ptr_, and oasys::PointerCache< _Name, _PtrType >::restore_and_update_ptr().

template<typename _Name, typename _PtrType>
virtual void oasys::PointerCache< _Name, _PtrType >::restore_and_update_ptr (  )  [protected, pure virtual]

Referenced by oasys::PointerCache< _Name, _PtrType >::operator *(), oasys::PointerCache< _Name, _PtrType >::operator->(), and oasys::PointerCache< _Name, _PtrType >::ptr().

template<typename _Name, typename _PtrType>
virtual bool oasys::PointerCache< _Name, _PtrType >::at_limit ( _PtrType *  ptr  )  [protected, pure virtual]

Referenced by oasys::PointerCache< _Name, _PtrType >::set_ptr().

template<typename _Name, typename _PtrType>
virtual void oasys::PointerCache< _Name, _PtrType >::evict (  )  [protected, pure virtual]

Referenced by oasys::PointerCache< _Name, _PtrType >::set_ptr().

template<typename _Name, typename _PtrType>
virtual void oasys::PointerCache< _Name, _PtrType >::register_ptr ( _PtrType *  ptr  )  [protected, pure virtual]

Referenced by oasys::PointerCache< _Name, _PtrType >::set_ptr().

template<typename _Name, typename _PtrType>
virtual void oasys::PointerCache< _Name, _PtrType >::unregister_ptr ( _PtrType *  ptr  )  [protected, pure virtual]

Referenced by oasys::PointerCache< _Name, _PtrType >::set_ptr().

template<typename _Name, typename _PtrType>
void oasys::PointerCache< _Name, _PtrType >::set_ptr ( _PtrType *  ptr  )  [inline, protected]

Definition at line 86 of file PointerCache.h.

References ASSERT, oasys::PointerCache< _Name, _PtrType >::at_limit(), oasys::PointerCache< _Name, _PtrType >::evict(), oasys::PointerCache< _Name, _PtrType >::ptr_, oasys::PointerCache< _Name, _PtrType >::register_ptr(), and oasys::PointerCache< _Name, _PtrType >::unregister_ptr().

Referenced by oasys::PointerCache< _Name, _PtrType >::operator=().


Member Data Documentation

template<typename _Name, typename _PtrType>
_PtrType* oasys::PointerCache< _Name, _PtrType >::ptr_ [protected]

Definition at line 77 of file PointerCache.h.

Referenced by oasys::PointerCache< _Name, _PtrType >::operator *(), oasys::PointerCache< _Name, _PtrType >::operator->(), oasys::PointerCache< _Name, _PtrType >::ptr(), and oasys::PointerCache< _Name, _PtrType >::set_ptr().


The documentation for this class was generated from the following file:
Generated on Fri Dec 22 14:48:08 2006 for DTN Reference Implementation by  doxygen 1.5.1