Open CASCADE Technology  7.8.1
Data Structures | Public Types | Public Member Functions
NCollection_Allocator< ItemType > Class Template Reference

Implements allocator requirements as defined in ISO C++ Standard 2003, section 20.1.5. More...

#include <NCollection_Allocator.hxx>

Data Structures

struct  rebind
 

Public Types

typedef ItemType value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 NCollection_Allocator () noexcept
 Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath. More...
 
 NCollection_Allocator (const Handle< NCollection_BaseAllocator > &) noexcept
 Constructor. More...
 
template<typename OtherType >
NCollection_Allocatoroperator= (const NCollection_Allocator< OtherType > &) noexcept
 Assignment operator. More...
 
template<typename OtherType >
 NCollection_Allocator (const NCollection_Allocator< OtherType > &) noexcept
 Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath. More...
 
pointer address (reference theItem) const
 Returns an object address. More...
 
const_pointer address (const_reference theItem) const
 Returns an object address. More...
 
pointer allocate (const size_type theSize, const void *=0) const
 Allocates memory for theSize objects. More...
 
void deallocate (pointer thePnt, const size_type) const
 Frees previously allocated memory. More...
 
pointer reallocate (pointer thePnt, const size_type theSize) const
 Reallocates memory for theSize objects. More...
 
template<class _Objty , class... _Types>
void construct (_Objty *_Ptr, _Types &&..._Args)
 Constructs an object. Uses placement new operator and copy constructor to construct an object. More...
 
void destroy (pointer thePnt)
 Destroys the object. Uses the object destructor. More...
 
bool operator== (const NCollection_Allocator &) const
 
template<class U >
bool operator== (const NCollection_Allocator< U > &) const noexcept
 
bool operator!= (const NCollection_Allocator &) const noexcept
 
template<class U >
bool operator!= (const NCollection_Allocator< U > &) const noexcept
 

Detailed Description

template<typename ItemType>
class NCollection_Allocator< ItemType >

Implements allocator requirements as defined in ISO C++ Standard 2003, section 20.1.5.

The allocator uses a standard OCCT mechanism for memory allocation and deallocation. It can be used with standard containers (std::vector, std::map, etc.) to take advantage of OCCT memory optimizations.

Example of use:

std::list<TopoDS_Shape, NCollection_Allocator<TopoDS_Shape>> aList(anSAllocator);
TopoDS_Solid aSolid = BRepPrimAPI_MakeBox(10., 20., 30.);
aList.push_back(aSolid);

Member Typedef Documentation

template<typename ItemType>
typedef const value_type* NCollection_Allocator< ItemType >::const_pointer
template<typename ItemType>
typedef const value_type& NCollection_Allocator< ItemType >::const_reference
template<typename ItemType>
typedef ptrdiff_t NCollection_Allocator< ItemType >::difference_type
template<typename ItemType>
typedef value_type* NCollection_Allocator< ItemType >::pointer
template<typename ItemType>
typedef value_type& NCollection_Allocator< ItemType >::reference
template<typename ItemType>
typedef size_t NCollection_Allocator< ItemType >::size_type
template<typename ItemType>
typedef ItemType NCollection_Allocator< ItemType >::value_type

Constructor & Destructor Documentation

template<typename ItemType>
NCollection_Allocator< ItemType >::NCollection_Allocator ( )
inlinenoexcept

Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath.

template<typename ItemType>
NCollection_Allocator< ItemType >::NCollection_Allocator ( const Handle< NCollection_BaseAllocator > &  )
inlinenoexcept

Constructor.

template<typename ItemType>
template<typename OtherType >
NCollection_Allocator< ItemType >::NCollection_Allocator ( const NCollection_Allocator< OtherType > &  )
inlinenoexcept

Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath.

Member Function Documentation

template<typename ItemType>
pointer NCollection_Allocator< ItemType >::address ( reference  theItem) const
inline

Returns an object address.

template<typename ItemType>
const_pointer NCollection_Allocator< ItemType >::address ( const_reference  theItem) const
inline

Returns an object address.

template<typename ItemType>
pointer NCollection_Allocator< ItemType >::allocate ( const size_type  theSize,
const void *  = 0 
) const
inline

Allocates memory for theSize objects.

template<typename ItemType>
template<class _Objty , class... _Types>
void NCollection_Allocator< ItemType >::construct ( _Objty *  _Ptr,
_Types &&...  _Args 
)
inline

Constructs an object. Uses placement new operator and copy constructor to construct an object.

template<typename ItemType>
void NCollection_Allocator< ItemType >::deallocate ( pointer  thePnt,
const size_type   
) const
inline

Frees previously allocated memory.

template<typename ItemType>
void NCollection_Allocator< ItemType >::destroy ( pointer  thePnt)
inline

Destroys the object. Uses the object destructor.

template<typename ItemType>
bool NCollection_Allocator< ItemType >::operator!= ( const NCollection_Allocator< ItemType > &  ) const
inlinenoexcept
template<typename ItemType>
template<class U >
bool NCollection_Allocator< ItemType >::operator!= ( const NCollection_Allocator< U > &  ) const
inlinenoexcept
template<typename ItemType>
template<typename OtherType >
NCollection_Allocator& NCollection_Allocator< ItemType >::operator= ( const NCollection_Allocator< OtherType > &  )
inlinenoexcept

Assignment operator.

template<typename ItemType>
bool NCollection_Allocator< ItemType >::operator== ( const NCollection_Allocator< ItemType > &  ) const
inline
template<typename ItemType>
template<class U >
bool NCollection_Allocator< ItemType >::operator== ( const NCollection_Allocator< U > &  ) const
inlinenoexcept
template<typename ItemType>
pointer NCollection_Allocator< ItemType >::reallocate ( pointer  thePnt,
const size_type  theSize 
) const
inline

Reallocates memory for theSize objects.


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