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

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
671  { // get alignment
672  return (_WIDTH * ((_Sz + _WIDTH - 1) / _WIDTH));
673  }
const int _WIDTH
Definition: allocators:633
template<class _Cache >
int stdext::allocators::rts_alloc< _Cache >::_IDX ( int  _Sz)
inlineprivate
666  { // get index
667  return (_Sz / _WIDTH);
668  }
const int _WIDTH
Definition: allocators:633
template<class _Cache >
void* stdext::allocators::rts_alloc< _Cache >::allocate ( size_t  _Count)
inline
641  { // allocate _Count bytes
642  _Count = _ALIGN(_Count);
643  return ((char *)(_Count < _WIDTH * _COUNT
645  : ::operator new(_Count)));
646  }
int _ALIGN(int _Sz)
Definition: allocators:670
const int _COUNT
Definition: allocators:634
int _IDX(int _Sz)
Definition: allocators:665
_Cache caches[_COUNT]
Definition: allocators:663
const int _WIDTH
Definition: allocators:633
_Diff _Count
Definition: algorithm:1941
void * allocate(size_t _Count)
Definition: allocators:640
template<class _Cache >
void stdext::allocators::rts_alloc< _Cache >::deallocate ( void _Ptr,
size_t  _Count 
)
inline
649  { // deallocate _Count bytes
650  _Count = _ALIGN(_Count);
651  if (_Count < _WIDTH * _COUNT)
652  caches[_IDX(_Count)].deallocate(_Ptr, _Count);
653  else
654  ::operator delete(_Ptr);
655  }
int _ALIGN(int _Sz)
Definition: allocators:670
const int _COUNT
Definition: allocators:634
int _IDX(int _Sz)
Definition: allocators:665
_Cache caches[_COUNT]
Definition: allocators:663
const int _WIDTH
Definition: allocators:633
_Diff _Count
Definition: algorithm:1941
template<class _Cache >
bool stdext::allocators::rts_alloc< _Cache >::equals ( const rts_alloc< _Cache > &  _Other) const
inline
658  { // caches can share data
659  return (caches[0].equals(_Other.caches[0]));
660  }
bool equals(const rts_alloc< _Cache > &_Other) const
Definition: allocators:657
_Cache caches[_COUNT]
Definition: allocators:663

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: