AllocatorRef< ALLOCATOR, HANDLER > Class Template Reference

#include <allocatorref.h>

Inheritance diagram for AllocatorRef< ALLOCATOR, HANDLER >:

Detailed Description

template<typename ALLOCATOR, typename HANDLER = StrongRefHandler>
class maxon::AllocatorRef< ALLOCATOR, HANDLER >

An AllocatorRef extends a BaseRef by forwarding all allocator calls (Alloc, Free, ...) to the referenced object. This can be used if a single allocator shall be shared by multiple objects such as arrays or maps, for example AllocatorRef<BlockArrayAllocator<123>> which is a BlockArrayAllocator held by a strong reference.

AllocatorRef inherits from BaseRef, so all of BaseRef's functions are available in addition to the allocator functions.

Template Parameters
ALLOCATORType of the referenced allocator.
HANDLERReference handler class for BaseRef, StrongRefHandler by default. This implements the specific behaviour whenever the reference is changed to point to another allocator, see BaseRef.
See also
BaseRef

Public Types

using Super = BaseRef< ALLOCATOR, HANDLER >
 
- Public Types inherited from BaseRef< ALLOCATOR, StrongRefHandler >
using ReferencedType = ALLOCATOR
 
using ConstReferencedType = typename ConstIf< ALLOCATOR, Bool(HANDLER::KIND &VALUEKIND::DEEP_CONSTNESS)>::type
 
using DirectlyReferencedType = ALLOCATOR
 
using SelfType = BaseRef< ALLOCATOR, StrongRefHandler >
 
using IsGenericBaseOf = std::true_type
 
using Handler = StrongRefHandler
 
using RefCompareType = RefCompare< MAXON_IS_COW_KIND(HANDLER::KIND), IsInterfaceType< ALLOCATOR >::value >
 

Public Member Functions

MAXON_ATTRIBUTE_FORCE_INLINE void * Alloc (Int s, MAXON_SOURCE_LOCATION_DECLARATION) const
 
MAXON_ATTRIBUTE_FORCE_INLINE void * AllocClear (Int s, MAXON_SOURCE_LOCATION_DECLARATION) const
 
MAXON_ATTRIBUTE_FORCE_INLINE void * Realloc (void *p, Int s, MAXON_SOURCE_LOCATION_DECLARATION) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Int ComputeArraySize (Int currentSize, Int increment, Int minChunkSize) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsCompatibleWithDefaultAllocator (void *p) const
 
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE void Free (T *&p) const
 
- Public Member Functions inherited from BaseRef< ALLOCATOR, StrongRefHandler >
 BaseRef ()
 
MAXON_IMPLICIT BaseRef (std::nullptr_t)=delete
 
MAXON_IMPLICIT BaseRef (ALLOCATOR *o)
 
 BaseRef (ForwardResultPtr< PTR > o)
 
 BaseRef (ResultPtr< ALLOCATOR > o, Int)
 
 BaseRef (const BaseRef &src)
 
MAXON_IMPLICIT BaseRef (const REF &src)
 
MAXON_IMPLICIT BaseRef (REF &src)
 
 BaseRef (BaseRef &&src)
 
MAXON_IMPLICIT BaseRef (REF &&src)
 
ALLOCATOR * GetPointer ()
 
ConstReferencedType * GetPointer () const
 
ALLOCATOR * operator-> ()
 
ConstReferencedType * operator-> () const
 
std::conditional< std::is_void< ALLOCATOR >::value, DeleteReturnType01, ALLOCATOR >::type & operator* ()
 
std::conditional< std::is_void< ConstReferencedType >::value, DeleteReturnType01, ALLOCATOR >::type & operator* () const
 
 operator ALLOCATOR * ()
 
 operator ConstReferencedType * () const
 
 operator Bool () const
 
 operator Bool ()
 
const std::conditional< std::is_void< ALLOCATOR >::value, DeleteReturnType01, ALLOCATOR >::type & operator[] (Int) const=delete
 
ResultRef< typename std::remove_const< ALLOCATOR >::type > MakeWritable (Bool resetOnError=true)
 
ResultRef< typename std::remove_const< ALLOCATOR >::type > MakeWritableDontCopy ()
 
Bool HasMultipleReferences () const
 
std::conditional< std::is_void< ALLOCATOR >::value, DeleteReturnType01, ALLOCATOR >::type & GetOrDefault () const
 
BaseRef & operator= (ALLOCATOR *src)
 
BaseRef & operator= (std::nullptr_t src)
 
BaseRef & operator= (const BaseRef &src)
 
BaseRef & operator= (const REF &src)
 
BaseRef & operator= (REF &src)
 
BaseRef & operator= (BaseRef &&src)
 
BaseRef & operator= (REF &&src)
 
 ~BaseRef ()
 
Bool operator== (const BaseRef &b) const
 
Bool operator== (const ALLOCATOR *b) const
 
Bool operator== (typename std::remove_const< ALLOCATOR >::type *b) const
 
Bool operator== (std::nullptr_t) const
 
Bool operator!= (const BaseRef &b) const
 
Bool operator!= (const ALLOCATOR *b) const
 
Bool operator!= (typename std::remove_const< ALLOCATOR >::type *b) const
 
Bool operator!= (std::nullptr_t) const
 
Bool operator< (const BaseRef &b) const
 
 MAXON_OPERATOR_INEQUALITY (BaseRef)
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
std::conditional< Bool(HANDLER::KIND &VALUEKIND::COW_MASK), typename std::remove_const< ALLOCATOR >::type, ALLOCATOR >::type * Disconnect ()
 
void PrivateSetTarget (ALLOCATOR *newPtr)
 
void PrivateSetPointer (ALLOCATOR *ptr)
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseRef< ALLOCATOR, StrongRefHandler >
static void PrivateLookupFn ()
 
static std::false_type GenericVarianceCheck (const void *)
 
static MAXON_ATTRIBUTE_FORCE_INLINE ResultMemT< BaseRef > Create (ARGS &&... args)
 
static const BaseRef & DefaultValueRef ()
 
static std::conditional< Bool(HANDLER::KIND &VALUEKIND::UNIQUE_REFERENCE), BaseRef, const BaseRef & >::type DefaultValue ()
 
- Public Attributes inherited from BaseRef< ALLOCATOR, StrongRefHandler >
ALLOCATOR * _object
 
const void * _impl
 
- Static Public Attributes inherited from BaseRef< ALLOCATOR, StrongRefHandler >
static constexpr Bool DIRECT_REF
 
- Protected Attributes inherited from BaseRef< ALLOCATOR, StrongRefHandler >
union {
   T *   _object
 
   const void *   _impl
 
}; 
 

Member Typedef Documentation

◆ Super

using Super = BaseRef<ALLOCATOR, HANDLER>

Member Function Documentation

◆ Alloc()

◆ AllocClear()

◆ Realloc()

MAXON_ATTRIBUTE_FORCE_INLINE void* Realloc ( void *  p,
Int  s,
MAXON_SOURCE_LOCATION_DECLARATION   
) const

◆ ComputeArraySize()

MAXON_ATTRIBUTE_FORCE_INLINE Int ComputeArraySize ( Int  currentSize,
Int  increment,
Int  minChunkSize 
) const

◆ IsCompatibleWithDefaultAllocator()

MAXON_ATTRIBUTE_FORCE_INLINE Bool IsCompatibleWithDefaultAllocator ( void *  p) const

◆ Free()

MAXON_ATTRIBUTE_FORCE_INLINE void Free ( T *&  p) const