STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
stdext::allocators::rts_alloc< _Cache > Class Template Reference

Public Member Functions

_DECLSPEC_ALLOCATOR voidallocate (size_t _Count)
 
void deallocate (void *_Ptr, size_t _Count)
 
bool equals (const rts_alloc< _Cache > &_Other) const
 

Private Member Functions

int _IDX (int _Sz)
 
int _ALIGN (int _Sz)
 

Private Attributes

_Cache caches [_COUNT]
 

Member Function Documentation

template<class _Cache >
int stdext::allocators::rts_alloc< _Cache >::_ALIGN ( int  _Sz)
inlineprivate
682  { // get alignment
683  return (_WIDTH * ((_Sz + _WIDTH - 1) / _WIDTH));
684  }
const int _WIDTH
Definition: allocators:644
template<class _Cache >
int stdext::allocators::rts_alloc< _Cache >::_IDX ( int  _Sz)
inlineprivate
677  { // get index
678  return (_Sz / _WIDTH);
679  }
const int _WIDTH
Definition: allocators:644
template<class _Cache >
_DECLSPEC_ALLOCATOR void* stdext::allocators::rts_alloc< _Cache >::allocate ( size_t  _Count)
inline
652  { // allocate _Count bytes
653  _Count = _ALIGN(_Count);
654  return ((char *)(_Count < _WIDTH * _COUNT
656  : ::operator new(_Count)));
657  }
int _ALIGN(int _Sz)
Definition: allocators:681
const int _COUNT
Definition: allocators:645
int _IDX(int _Sz)
Definition: allocators:676
_Cache caches[_COUNT]
Definition: allocators:674
const int _WIDTH
Definition: allocators:644
_Diff _Count
Definition: algorithm:1941
_DECLSPEC_ALLOCATOR void * allocate(size_t _Count)
Definition: allocators:651
template<class _Cache >
void stdext::allocators::rts_alloc< _Cache >::deallocate ( void _Ptr,
size_t  _Count 
)
inline
660  { // deallocate _Count bytes
661  _Count = _ALIGN(_Count);
662  if (_Count < _WIDTH * _COUNT)
663  caches[_IDX(_Count)].deallocate(_Ptr, _Count);
664  else
665  ::operator delete(_Ptr);
666  }
int _ALIGN(int _Sz)
Definition: allocators:681
const int _COUNT
Definition: allocators:645
int _IDX(int _Sz)
Definition: allocators:676
_Cache caches[_COUNT]
Definition: allocators:674
const int _WIDTH
Definition: allocators:644
_Diff _Count
Definition: algorithm:1941
template<class _Cache >
bool stdext::allocators::rts_alloc< _Cache >::equals ( const rts_alloc< _Cache > &  _Other) const
inline
669  { // caches can share data
670  return (caches[0].equals(_Other.caches[0]));
671  }
bool equals(const rts_alloc< _Cache > &_Other) const
Definition: allocators:668
_Cache caches[_COUNT]
Definition: allocators:674

Member Data Documentation

template<class _Cache >
_Cache stdext::allocators::rts_alloc< _Cache >::caches[_COUNT]
private

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