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
678  { // get alignment
679  return (_WIDTH * ((_Sz + _WIDTH - 1) / _WIDTH));
680  }
const int _WIDTH
Definition: allocators:640
template<class _Cache >
int stdext::allocators::rts_alloc< _Cache >::_IDX ( int  _Sz)
inlineprivate
673  { // get index
674  return (_Sz / _WIDTH);
675  }
const int _WIDTH
Definition: allocators:640
template<class _Cache >
_DECLSPEC_ALLOCATOR void* stdext::allocators::rts_alloc< _Cache >::allocate ( size_t  _Count)
inline
648  { // allocate _Count bytes
649  _Count = _ALIGN(_Count);
650  return ((char *)(_Count < _WIDTH * _COUNT
652  : ::operator new(_Count)));
653  }
unsigned int _Count
Definition: xcomplex:668
int _ALIGN(int _Sz)
Definition: allocators:677
const int _COUNT
Definition: allocators:641
int _IDX(int _Sz)
Definition: allocators:672
_Cache caches[_COUNT]
Definition: allocators:670
const int _WIDTH
Definition: allocators:640
_DECLSPEC_ALLOCATOR void * allocate(size_t _Count)
Definition: allocators:647
template<class _Cache >
void stdext::allocators::rts_alloc< _Cache >::deallocate ( void _Ptr,
size_t  _Count 
)
inline
656  { // deallocate _Count bytes
657  _Count = _ALIGN(_Count);
658  if (_Count < _WIDTH * _COUNT)
659  caches[_IDX(_Count)].deallocate(_Ptr, _Count);
660  else
661  ::operator delete(_Ptr);
662  }
unsigned int _Count
Definition: xcomplex:668
int _ALIGN(int _Sz)
Definition: allocators:677
const int _COUNT
Definition: allocators:641
int _IDX(int _Sz)
Definition: allocators:672
_Cache caches[_COUNT]
Definition: allocators:670
const int _WIDTH
Definition: allocators:640
template<class _Cache >
bool stdext::allocators::rts_alloc< _Cache >::equals ( const rts_alloc< _Cache > &  _Other) const
inline
665  { // caches can share data
666  return (caches[0].equals(_Other.caches[0]));
667  }
bool equals(const rts_alloc< _Cache > &_Other) const
Definition: allocators:664
_Cache caches[_COUNT]
Definition: allocators:670

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: