Open CASCADE Technology 7.8.2.dev
NCollection_OccAllocator< ItemType > Class Template Reference

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

#include <NCollection_OccAllocator.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
 
typedef std::false_type propagate_on_container_move_assignment
 

Public Member Functions

 NCollection_OccAllocator ()
 Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath.
 
 NCollection_OccAllocator (const Handle< NCollection_BaseAllocator > &theAlloc)
 Constructor.
 
 NCollection_OccAllocator (Handle< NCollection_BaseAllocator > &&theAlloc)
 Constructor.
 
 NCollection_OccAllocator (const NCollection_OccAllocator &theOther)
 Constructor.
 
 NCollection_OccAllocator (NCollection_OccAllocator &&theOther) noexcept
 Constructor.
 
NCollection_OccAllocatoroperator= (const NCollection_OccAllocator &theOther)
 Assignment operator.
 
NCollection_OccAllocatoroperator= (NCollection_OccAllocator &&theOther) noexcept
 Assignment operator.
 
template<typename OtherType >
NCollection_OccAllocatoroperator= (const NCollection_OccAllocator< OtherType > &theOther)
 Assignment operator.
 
template<typename OtherType >
 NCollection_OccAllocator (const NCollection_OccAllocator< OtherType > &theOther)
 Constructor. Creates an object using the default Open CASCADE allocation mechanism, i.e., which uses Standard::Allocate() and Standard::Free() underneath.
 
void SetAllocator (const Handle< NCollection_BaseAllocator > &theAlloc)
 
const Handle< NCollection_BaseAllocator > & Allocator () const
 
pointer allocate (size_type theSize, const void *=0)
 Allocates memory for theSize objects.
 
template<typename T >
void deallocate (T *thePnt, size_type)
 Template version of function Free(), nullifies the argument pointer.
 
void deallocate (pointer thePnt, size_type)
 Frees previously allocated memory.
 
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.
 
pointer address (reference theItem) const
 Returns an object address.
 
const_pointer address (const_reference theItem) const
 Returns an object address.
 
template<class _Uty >
void destroy (_Uty *_Ptr)
 Destroys the object. Uses the object destructor.
 
size_t max_size () const noexcept
 Estimate maximum array size.
 
bool operator== (const NCollection_OccAllocator &theOther) const
 
template<class U >
bool operator== (const NCollection_OccAllocator< U > &theOther) const
 
bool operator!= (const NCollection_OccAllocator &theOther) const
 
template<class U >
bool operator!= (const NCollection_OccAllocator< U > &theOther) const
 

Detailed Description

template<typename ItemType>
class NCollection_OccAllocator< 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_OccAllocator<TopoDS_Shape>> aList(anSAllocator);
TopoDS_Solid aSolid = BRepPrimAPI_MakeBox(10., 20., 30.);
aList.push_back(aSolid);
Describes functions to build parallelepiped boxes. A MakeBox object provides a framework for:
Definition BRepPrimAPI_MakeBox.hxx:52
Implements allocator requirements as defined in ISO C++ Standard 2003, section 20....
Definition NCollection_OccAllocator.hxx:37
Describes a solid shape which.
Definition TopoDS_Solid.hxx:31

Member Typedef Documentation

◆ const_pointer

template<typename ItemType >
const value_type* NCollection_OccAllocator< ItemType >::const_pointer

◆ const_reference

template<typename ItemType >
const value_type& NCollection_OccAllocator< ItemType >::const_reference

◆ difference_type

template<typename ItemType >
ptrdiff_t NCollection_OccAllocator< ItemType >::difference_type

◆ pointer

template<typename ItemType >
value_type* NCollection_OccAllocator< ItemType >::pointer

◆ propagate_on_container_move_assignment

template<typename ItemType >
std::false_type NCollection_OccAllocator< ItemType >::propagate_on_container_move_assignment

◆ reference

template<typename ItemType >
value_type& NCollection_OccAllocator< ItemType >::reference

◆ size_type

template<typename ItemType >
size_t NCollection_OccAllocator< ItemType >::size_type

◆ value_type

template<typename ItemType >
ItemType NCollection_OccAllocator< ItemType >::value_type

Constructor & Destructor Documentation

◆ NCollection_OccAllocator() [1/6]

template<typename ItemType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( )
inline

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

◆ NCollection_OccAllocator() [2/6]

template<typename ItemType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( const Handle< NCollection_BaseAllocator > & theAlloc)
inline

Constructor.

◆ NCollection_OccAllocator() [3/6]

template<typename ItemType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( Handle< NCollection_BaseAllocator > && theAlloc)
inline

Constructor.

◆ NCollection_OccAllocator() [4/6]

template<typename ItemType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( const NCollection_OccAllocator< ItemType > & theOther)
inline

Constructor.

◆ NCollection_OccAllocator() [5/6]

template<typename ItemType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( NCollection_OccAllocator< ItemType > && theOther)
inlinenoexcept

Constructor.

◆ NCollection_OccAllocator() [6/6]

template<typename ItemType >
template<typename OtherType >
NCollection_OccAllocator< ItemType >::NCollection_OccAllocator ( const NCollection_OccAllocator< OtherType > & theOther)
inline

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

Member Function Documentation

◆ address() [1/2]

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

Returns an object address.

◆ address() [2/2]

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

Returns an object address.

◆ allocate()

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

Allocates memory for theSize objects.

◆ Allocator()

template<typename ItemType >
const Handle< NCollection_BaseAllocator > & NCollection_OccAllocator< ItemType >::Allocator ( ) const
inline

◆ construct()

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

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

◆ deallocate() [1/2]

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

Frees previously allocated memory.

◆ deallocate() [2/2]

template<typename ItemType >
template<typename T >
void NCollection_OccAllocator< ItemType >::deallocate ( T * thePnt,
size_type  )
inline

Template version of function Free(), nullifies the argument pointer.

Parameters
thePtr- previously allocated memory block to be freed

◆ destroy()

template<typename ItemType >
template<class _Uty >
void NCollection_OccAllocator< ItemType >::destroy ( _Uty * _Ptr)
inline

Destroys the object. Uses the object destructor.

◆ max_size()

template<typename ItemType >
size_t NCollection_OccAllocator< ItemType >::max_size ( ) const
inlinenoexcept

Estimate maximum array size.

◆ operator!=() [1/2]

template<typename ItemType >
bool NCollection_OccAllocator< ItemType >::operator!= ( const NCollection_OccAllocator< ItemType > & theOther) const
inline

◆ operator!=() [2/2]

template<typename ItemType >
template<class U >
bool NCollection_OccAllocator< ItemType >::operator!= ( const NCollection_OccAllocator< U > & theOther) const
inline

◆ operator=() [1/3]

template<typename ItemType >
NCollection_OccAllocator & NCollection_OccAllocator< ItemType >::operator= ( const NCollection_OccAllocator< ItemType > & theOther)
inline

Assignment operator.

◆ operator=() [2/3]

template<typename ItemType >
template<typename OtherType >
NCollection_OccAllocator & NCollection_OccAllocator< ItemType >::operator= ( const NCollection_OccAllocator< OtherType > & theOther)
inline

Assignment operator.

◆ operator=() [3/3]

template<typename ItemType >
NCollection_OccAllocator & NCollection_OccAllocator< ItemType >::operator= ( NCollection_OccAllocator< ItemType > && theOther)
inlinenoexcept

Assignment operator.

◆ operator==() [1/2]

template<typename ItemType >
bool NCollection_OccAllocator< ItemType >::operator== ( const NCollection_OccAllocator< ItemType > & theOther) const
inline

◆ operator==() [2/2]

template<typename ItemType >
template<class U >
bool NCollection_OccAllocator< ItemType >::operator== ( const NCollection_OccAllocator< U > & theOther) const
inline

◆ SetAllocator()

template<typename ItemType >
void NCollection_OccAllocator< ItemType >::SetAllocator ( const Handle< NCollection_BaseAllocator > & theAlloc)
inline

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